<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 530 |
|
19년 전 | 1222 | |
| 529 |
|
19년 전 | 1401 | |
| 528 |
|
19년 전 | 1968 | |
| 527 |
사랑과우정
|
19년 전 | 2384 | |
| 526 | 19년 전 | 2865 | ||
| 525 |
|
19년 전 | 2289 | |
| 524 |
|
19년 전 | 1787 | |
| 523 | 19년 전 | 7026 | ||
| 522 |
|
19년 전 | 3719 | |
| 521 | 19년 전 | 2323 | ||
| 520 | 19년 전 | 2357 | ||
| 519 | 19년 전 | 2848 | ||
| 518 |
|
19년 전 | 5767 | |
| 517 |
|
19년 전 | 5540 | |
| 516 |
|
19년 전 | 2244 | |
| 515 |
|
19년 전 | 3283 | |
| 514 | 19년 전 | 2854 | ||
| 513 | 19년 전 | 2207 | ||
| 512 |
개발자관리자
|
19년 전 | 2721 | |
| 511 |
개발자관리자
|
19년 전 | 1570 | |
| 510 |
개발자관리자
|
19년 전 | 1731 | |
| 509 |
개발자관리자
|
19년 전 | 1825 | |
| 508 |
개발자관리자
|
19년 전 | 1997 | |
| 507 |
개발자관리자
|
19년 전 | 1679 | |
| 506 |
개발자관리자
|
19년 전 | 1798 | |
| 505 |
개발자관리자
|
19년 전 | 1765 | |
| 504 |
개발자관리자
|
19년 전 | 1841 | |
| 503 |
개발자관리자
|
19년 전 | 1513 | |
| 502 |
개발자관리자
|
19년 전 | 2636 | |
| 501 | 19년 전 | 1980 | ||
| 500 | 19년 전 | 3230 | ||
| 499 | 19년 전 | 3255 | ||
| 498 | 19년 전 | 2511 | ||
| 497 | 19년 전 | 2597 | ||
| 496 | 19년 전 | 2433 | ||
| 495 | 19년 전 | 2693 | ||
| 494 | 19년 전 | 2671 | ||
| 493 | 19년 전 | 3161 | ||
| 492 | 19년 전 | 2867 | ||
| 491 | 19년 전 | 5288 | ||
| 490 |
|
19년 전 | 2111 | |
| 489 |
|
19년 전 | 2197 | |
| 488 |
|
19년 전 | 1998 | |
| 487 |
|
19년 전 | 1932 | |
| 486 |
|
19년 전 | 1931 | |
| 485 |
|
19년 전 | 2125 | |
| 484 |
|
19년 전 | 3195 | |
| 483 |
|
19년 전 | 3074 | |
| 482 |
|
19년 전 | 2837 | |
| 481 |
|
19년 전 | 2534 | |
| 480 |
|
19년 전 | 2619 | |
| 479 |
|
19년 전 | 2289 | |
| 478 |
|
19년 전 | 2320 | |
| 477 |
개발자관리자
|
19년 전 | 1578 | |
| 476 |
개발자관리자
|
19년 전 | 2303 | |
| 475 |
개발자관리자
|
19년 전 | 2651 | |
| 474 |
개발자관리자
|
19년 전 | 2646 | |
| 473 |
개발자관리자
|
19년 전 | 2957 | |
| 472 | 19년 전 | 2728 | ||
| 471 | 19년 전 | 1707 | ||
| 470 | 19년 전 | 1809 | ||
| 469 |
|
19년 전 | 2712 | |
| 468 |
|
19년 전 | 2210 | |
| 467 |
|
19년 전 | 3976 | |
| 466 |
|
19년 전 | 2486 | |
| 465 | 19년 전 | 2366 | ||
| 464 | 19년 전 | 3510 | ||
| 463 |
|
19년 전 | 3090 | |
| 462 |
|
19년 전 | 2233 | |
| 461 |
|
19년 전 | 3027 | |
| 460 |
|
19년 전 | 2231 | |
| 459 |
|
19년 전 | 3086 | |
| 458 |
|
19년 전 | 3509 | |
| 457 |
|
19년 전 | 5199 | |
| 456 |
|
19년 전 | 3121 | |
| 455 |
스마일미디어
|
19년 전 | 3118 | |
| 454 |
스마일미디어
|
19년 전 | 2704 | |
| 453 |
스마일미디어
|
19년 전 | 2448 | |
| 452 |
스마일미디어
|
19년 전 | 2707 | |
| 451 |
스마일미디어
|
19년 전 | 2429 | |
| 450 |
스마일미디어
|
19년 전 | 2550 | |
| 449 |
스마일미디어
|
19년 전 | 2349 | |
| 448 |
스마일미디어
|
19년 전 | 2684 | |
| 447 | 19년 전 | 2954 | ||
| 446 |
스마일미디어
|
19년 전 | 3238 | |
| 445 |
스마일미디어
|
19년 전 | 7039 | |
| 444 |
스마일미디어
|
19년 전 | 5162 | |
| 443 |
스마일미디어
|
19년 전 | 2413 | |
| 442 |
스마일미디어
|
19년 전 | 5145 | |
| 441 |
스마일미디어
|
19년 전 | 3087 | |
| 440 |
|
19년 전 | 2439 | |
| 439 | 19년 전 | 2136 | ||
| 438 | 19년 전 | 3562 | ||
| 437 |
|
19년 전 | 2866 | |
| 436 |
|
19년 전 | 3243 | |
| 435 |
|
19년 전 | 2870 | |
| 434 | 19년 전 | 3374 | ||
| 433 |
sjsjin
|
19년 전 | 2698 | |
| 432 |
sjsjin
|
19년 전 | 3447 | |
| 431 |
sjsjin
|
19년 전 | 2408 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기