<style>
#excel {width: 800px; height: 400px; overflow: auto; border: 1px solid #ccc}
#excel table { width: 2000px; border-spacing:0 }
#excel table th {font-weight: normal; background-color: #eee}
#excel table th, #excel table td { height: 20px; border: 1px solid #ddd; }
#excel table td {text-align: right; padding: 0; }
#excel table input {border:none; border-right:0px; border-top:0px; boder-left:0px; boder-bottom:0px; outline-style: none; font-size: 1em }
</style>
<div id="excel"></div>
<script>
function Excel(label, rows, cols) {
this.div = document.getElementById(label);
this.table = document.createElement('table');
this.rows = rows;
this.cols = cols;
this.clicked = null;
this.cells = [];
}
Excel.prototype.init = function() {
var tr = {}, el = {}, r = 0, c = 0, tr = document.createElement('tr')
for (c=0; c<this.cols; c++) {
el = document.createElement('th');
el.style.width = Math.round(100 / this.cols * 10) / 10 + '%';
if (c != 0) el.textContent = String.fromCharCode(64 + c);
tr.appendChild(el);
}
this.table.appendChild(tr);
for (r=1; r<this.rows; r++) {
tr = document.createElement('tr');
for (c=0; c<this.cols; c++) {
if (c !=0) el= document.createElement('td');
else {
el= document.createElement('th');
el.textContent = r;
}
tr.appendChild(el);
}
this.table.appendChild(tr);
}
this.div.appendChild(this.table);
};
Excel.prototype.getPos = function(obj) {
var pos = {};
pos.r = obj.parentNode.rowIndex;
pos.c = obj.cellIndex;
return pos;
}
Excel.prototype.click = function() {
var td = this, textbox, text, pos = excel.getPos(this);
if (excel.clicked != null) excel.clicked.style.border = '1px solid #ddd';
this.style.border = '1px solid blue';
excel.clicked = this;
textbox = document.createElement('input');
if (this.hasChildNodes()) {
if (this.firstChild.nodeName == 'INPUT') return;
else {
text = this.firstChild.textContent;
textbox.value = excel.cells[pos.r + ',' + pos.c];
this.removeChild(this.firstChild);
}
}
textbox.type = 'text';
textbox.style.width = (this.offsetWidth - 2) + 'px';
textbox.style.height = (this.offsetHeight - 4) + 'px';
this.appendChild(textbox);
this.firstChild.focus();
textbox.onblur = function(){
text = this.value;
this.remove(0);
excel.cells[pos.r + ',' + pos.c] = text;
if (text.match(/^=/)) text = eval( text.replace('=', '') );
td.textContent = text;
};
}
Excel.prototype.edit = function() {
var table, tr = {}, el = {}, r = 0, c = 0,
table = this.div.childNodes[0];
for (r=1; r<this.rows; r++) {
for (c=1; c<this.cols; c++) {
el = table.rows[r].cells[c];
el.onclick = this.click;
el.onkeydown = this.keydown;
}
}
};
Excel.prototype.keydown = function(e) {
var pos = excel.getPos(this), e = e || window.event;
switch (e.keyCode) {
case 38 : pos.r -= 1; break;
case 40 : case 13: pos.r += 1; break;
case 37 : pos.c -= 1; break;
case 39 : pos.c += 1; break;
}
if (pos.r < 1 || pos.r > excel.rows-1 || pos.c < 1 || pos.c > excel.cols-1) return;
excel.table.rows[pos.r].cells[pos.c].click();
};
var excel = new Excel('excel', 40, 27);
excel.init();
excel.edit();
</script>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 630 | 19년 전 | 2360 | ||
| 629 |
|
19년 전 | 2017 | |
| 628 |
|
19년 전 | 3133 | |
| 627 |
|
19년 전 | 2035 | |
| 626 |
|
19년 전 | 2069 | |
| 625 |
|
19년 전 | 1726 | |
| 624 |
|
19년 전 | 2238 | |
| 623 | 19년 전 | 2208 | ||
| 622 |
|
19년 전 | 2514 | |
| 621 |
|
19년 전 | 2922 | |
| 620 |
|
19년 전 | 2417 | |
| 619 | 19년 전 | 2483 | ||
| 618 | 19년 전 | 3518 | ||
| 617 |
|
19년 전 | 3238 | |
| 616 |
|
19년 전 | 3229 | |
| 615 |
|
19년 전 | 3050 | |
| 614 |
|
19년 전 | 2050 | |
| 613 |
|
19년 전 | 2385 | |
| 612 |
|
19년 전 | 2244 | |
| 611 |
|
19년 전 | 2091 | |
| 610 |
|
19년 전 | 2524 | |
| 609 |
|
19년 전 | 2434 | |
| 608 |
|
19년 전 | 2823 | |
| 607 | 19년 전 | 2196 | ||
| 606 | 19년 전 | 3542 | ||
| 605 | 19년 전 | 1997 | ||
| 604 | 19년 전 | 2615 | ||
| 603 | 19년 전 | 1622 | ||
| 602 |
|
19년 전 | 2843 | |
| 601 | 19년 전 | 3076 | ||
| 600 |
|
19년 전 | 2157 | |
| 599 | 19년 전 | 2006 | ||
| 598 | 19년 전 | 2489 | ||
| 597 | 19년 전 | 2395 | ||
| 596 |
|
19년 전 | 3081 | |
| 595 |
|
19년 전 | 6765 | |
| 594 | 19년 전 | 2715 | ||
| 593 | 19년 전 | 3192 | ||
| 592 |
|
19년 전 | 3096 | |
| 591 |
|
19년 전 | 1943 | |
| 590 | 19년 전 | 3370 | ||
| 589 | 19년 전 | 2215 | ||
| 588 |
|
19년 전 | 2708 | |
| 587 | 19년 전 | 2349 | ||
| 586 |
|
19년 전 | 4371 | |
| 585 | 19년 전 | 2498 | ||
| 584 | 19년 전 | 2769 | ||
| 583 |
|
19년 전 | 3531 | |
| 582 |
|
19년 전 | 3727 | |
| 581 |
|
19년 전 | 3262 | |
| 580 | 19년 전 | 2490 | ||
| 579 | 19년 전 | 3084 | ||
| 578 | 19년 전 | 3994 | ||
| 577 | 19년 전 | 3827 | ||
| 576 | 19년 전 | 1765 | ||
| 575 |
|
19년 전 | 2225 | |
| 574 |
|
19년 전 | 5407 | |
| 573 | 19년 전 | 6735 | ||
| 572 | 19년 전 | 2578 | ||
| 571 | 19년 전 | 2115 | ||
| 570 | 19년 전 | 2605 | ||
| 569 | 19년 전 | 3315 | ||
| 568 | 19년 전 | 3542 | ||
| 567 | 19년 전 | 2986 | ||
| 566 | 19년 전 | 2606 | ||
| 565 |
|
19년 전 | 4728 | |
| 564 |
|
19년 전 | 6736 | |
| 563 |
|
19년 전 | 5017 | |
| 562 |
|
19년 전 | 5960 | |
| 561 |
|
19년 전 | 2708 | |
| 560 |
|
19년 전 | 2560 | |
| 559 |
|
19년 전 | 2227 | |
| 558 |
|
19년 전 | 2306 | |
| 557 | 19년 전 | 4596 | ||
| 556 |
|
19년 전 | 4673 | |
| 555 | 19년 전 | 2517 | ||
| 554 | 19년 전 | 2182 | ||
| 553 | 19년 전 | 2529 | ||
| 552 |
|
19년 전 | 3173 | |
| 551 | 19년 전 | 2947 | ||
| 550 |
|
19년 전 | 1905 | |
| 549 |
|
19년 전 | 1964 | |
| 548 |
|
19년 전 | 3155 | |
| 547 |
|
19년 전 | 2357 | |
| 546 |
|
19년 전 | 3628 | |
| 545 |
|
19년 전 | 2559 | |
| 544 |
|
19년 전 | 1860 | |
| 543 |
|
19년 전 | 2459 | |
| 542 |
|
19년 전 | 1731 | |
| 541 |
|
19년 전 | 1414 | |
| 540 |
|
19년 전 | 1553 | |
| 539 |
|
19년 전 | 1808 | |
| 538 |
|
19년 전 | 1591 | |
| 537 |
|
19년 전 | 1795 | |
| 536 |
|
19년 전 | 1567 | |
| 535 |
|
19년 전 | 1962 | |
| 534 |
|
19년 전 | 1853 | |
| 533 |
|
19년 전 | 1457 | |
| 532 |
|
19년 전 | 1449 | |
| 531 |
|
19년 전 | 1369 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기