<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 486 | ||
| 7929 | 9년 전 | 420 | ||
| 7928 | 9년 전 | 495 | ||
| 7927 | 9년 전 | 403 | ||
| 7926 | 9년 전 | 713 | ||
| 7925 | 9년 전 | 439 | ||
| 7924 | 9년 전 | 419 | ||
| 7923 | 9년 전 | 412 | ||
| 7922 | 9년 전 | 433 | ||
| 7921 | 9년 전 | 449 | ||
| 7920 | 9년 전 | 358 | ||
| 7919 | 9년 전 | 366 | ||
| 7918 | 9년 전 | 515 | ||
| 7917 | 9년 전 | 376 | ||
| 7916 | 9년 전 | 460 | ||
| 7915 | 9년 전 | 479 | ||
| 7914 | 9년 전 | 487 | ||
| 7913 | 9년 전 | 658 | ||
| 7912 | 9년 전 | 496 | ||
| 7911 | 9년 전 | 418 | ||
| 7910 | 9년 전 | 466 | ||
| 7909 | 9년 전 | 583 | ||
| 7908 | 10년 전 | 514 | ||
| 7907 | 10년 전 | 458 | ||
| 7906 | 10년 전 | 480 | ||
| 7905 | 10년 전 | 441 | ||
| 7904 | 10년 전 | 432 | ||
| 7903 | 10년 전 | 439 | ||
| 7902 | 10년 전 | 616 | ||
| 7901 |
|
10년 전 | 787 | |
| 7900 | 10년 전 | 672 | ||
| 7899 | 10년 전 | 461 | ||
| 7898 | 10년 전 | 456 | ||
| 7897 | 10년 전 | 415 | ||
| 7896 | 10년 전 | 430 | ||
| 7895 | 10년 전 | 550 | ||
| 7894 | 10년 전 | 456 | ||
| 7893 | 10년 전 | 430 | ||
| 7892 | 10년 전 | 472 | ||
| 7891 | 10년 전 | 828 | ||
| 7890 | 10년 전 | 1255 | ||
| 7889 | 10년 전 | 798 | ||
| 7888 |
limsy1987
|
10년 전 | 610 | |
| 7887 | 10년 전 | 650 | ||
| 7886 | 10년 전 | 532 | ||
| 7885 | 10년 전 | 501 | ||
| 7884 | 10년 전 | 497 | ||
| 7883 | 10년 전 | 503 | ||
| 7882 | 10년 전 | 557 | ||
| 7881 | 10년 전 | 538 | ||
| 7880 | 10년 전 | 654 | ||
| 7879 | 10년 전 | 544 | ||
| 7878 | 10년 전 | 1307 | ||
| 7877 | 10년 전 | 836 | ||
| 7876 | 10년 전 | 573 | ||
| 7875 | 10년 전 | 647 | ||
| 7874 |
|
10년 전 | 852 | |
| 7873 | 10년 전 | 579 | ||
| 7872 | 10년 전 | 735 | ||
| 7871 | 10년 전 | 553 | ||
| 7870 | 10년 전 | 671 | ||
| 7869 | 10년 전 | 488 | ||
| 7868 | 10년 전 | 529 | ||
| 7867 | 10년 전 | 534 | ||
| 7866 | 10년 전 | 591 | ||
| 7865 | 10년 전 | 534 | ||
| 7864 | 10년 전 | 589 | ||
| 7863 | 10년 전 | 588 | ||
| 7862 | 10년 전 | 558 | ||
| 7861 | 10년 전 | 727 | ||
| 7860 | 10년 전 | 706 | ||
| 7859 | 10년 전 | 474 | ||
| 7858 | 10년 전 | 780 | ||
| 7857 | 10년 전 | 1169 | ||
| 7856 | 10년 전 | 595 | ||
| 7855 | 10년 전 | 836 | ||
| 7854 | 10년 전 | 779 | ||
| 7853 | 10년 전 | 675 | ||
| 7852 | 10년 전 | 592 | ||
| 7851 | 10년 전 | 592 | ||
| 7850 | 10년 전 | 670 | ||
| 7849 | 10년 전 | 444 | ||
| 7848 | 10년 전 | 508 | ||
| 7847 | 10년 전 | 741 | ||
| 7846 | 10년 전 | 527 | ||
| 7845 | 10년 전 | 499 | ||
| 7844 | 10년 전 | 469 | ||
| 7843 | 10년 전 | 507 | ||
| 7842 | 10년 전 | 485 | ||
| 7841 | 10년 전 | 455 | ||
| 7840 | 10년 전 | 480 | ||
| 7839 | 10년 전 | 519 | ||
| 7838 | 10년 전 | 590 | ||
| 7837 | 10년 전 | 419 | ||
| 7836 | 10년 전 | 460 | ||
| 7835 | 10년 전 | 547 | ||
| 7834 |
|
10년 전 | 1248 | |
| 7833 | 10년 전 | 507 | ||
| 7832 | 10년 전 | 491 | ||
| 7831 | 10년 전 | 663 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기