<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년 전 | 371 | ||
| 7929 | 9년 전 | 263 | ||
| 7928 | 9년 전 | 374 | ||
| 7927 | 9년 전 | 297 | ||
| 7926 | 9년 전 | 644 | ||
| 7925 | 9년 전 | 312 | ||
| 7924 | 9년 전 | 286 | ||
| 7923 | 9년 전 | 322 | ||
| 7922 | 9년 전 | 344 | ||
| 7921 | 9년 전 | 374 | ||
| 7920 | 9년 전 | 295 | ||
| 7919 | 9년 전 | 312 | ||
| 7918 | 9년 전 | 475 | ||
| 7917 | 9년 전 | 315 | ||
| 7916 | 9년 전 | 384 | ||
| 7915 | 9년 전 | 367 | ||
| 7914 | 9년 전 | 379 | ||
| 7913 | 9년 전 | 505 | ||
| 7912 | 9년 전 | 379 | ||
| 7911 | 9년 전 | 332 | ||
| 7910 | 9년 전 | 360 | ||
| 7909 | 9년 전 | 471 | ||
| 7908 | 9년 전 | 369 | ||
| 7907 | 9년 전 | 321 | ||
| 7906 | 9년 전 | 336 | ||
| 7905 | 9년 전 | 329 | ||
| 7904 | 9년 전 | 297 | ||
| 7903 | 9년 전 | 294 | ||
| 7902 | 9년 전 | 514 | ||
| 7901 |
|
9년 전 | 716 | |
| 7900 | 9년 전 | 538 | ||
| 7899 | 9년 전 | 346 | ||
| 7898 | 9년 전 | 339 | ||
| 7897 | 9년 전 | 296 | ||
| 7896 | 9년 전 | 316 | ||
| 7895 | 9년 전 | 425 | ||
| 7894 | 9년 전 | 347 | ||
| 7893 | 9년 전 | 279 | ||
| 7892 | 9년 전 | 323 | ||
| 7891 | 9년 전 | 710 | ||
| 7890 | 9년 전 | 1175 | ||
| 7889 | 9년 전 | 730 | ||
| 7888 |
limsy1987
|
9년 전 | 528 | |
| 7887 | 9년 전 | 499 | ||
| 7886 | 9년 전 | 389 | ||
| 7885 | 9년 전 | 361 | ||
| 7884 | 9년 전 | 370 | ||
| 7883 | 9년 전 | 350 | ||
| 7882 | 9년 전 | 363 | ||
| 7881 | 9년 전 | 392 | ||
| 7880 | 9년 전 | 519 | ||
| 7879 | 9년 전 | 412 | ||
| 7878 | 9년 전 | 1157 | ||
| 7877 | 9년 전 | 707 | ||
| 7876 | 9년 전 | 436 | ||
| 7875 | 9년 전 | 510 | ||
| 7874 |
|
9년 전 | 781 | |
| 7873 | 9년 전 | 482 | ||
| 7872 | 9년 전 | 617 | ||
| 7871 | 9년 전 | 446 | ||
| 7870 | 9년 전 | 569 | ||
| 7869 | 9년 전 | 388 | ||
| 7868 | 9년 전 | 384 | ||
| 7867 | 9년 전 | 381 | ||
| 7866 | 9년 전 | 441 | ||
| 7865 | 9년 전 | 398 | ||
| 7864 | 9년 전 | 464 | ||
| 7863 | 9년 전 | 454 | ||
| 7862 | 9년 전 | 432 | ||
| 7861 | 9년 전 | 589 | ||
| 7860 | 9년 전 | 595 | ||
| 7859 | 9년 전 | 363 | ||
| 7858 | 9년 전 | 672 | ||
| 7857 | 9년 전 | 1021 | ||
| 7856 | 9년 전 | 484 | ||
| 7855 | 9년 전 | 699 | ||
| 7854 | 9년 전 | 699 | ||
| 7853 | 9년 전 | 539 | ||
| 7852 | 9년 전 | 473 | ||
| 7851 | 9년 전 | 447 | ||
| 7850 | 9년 전 | 542 | ||
| 7849 | 9년 전 | 316 | ||
| 7848 | 9년 전 | 367 | ||
| 7847 | 9년 전 | 589 | ||
| 7846 | 9년 전 | 405 | ||
| 7845 | 9년 전 | 368 | ||
| 7844 | 9년 전 | 367 | ||
| 7843 | 9년 전 | 373 | ||
| 7842 | 9년 전 | 367 | ||
| 7841 | 9년 전 | 354 | ||
| 7840 | 9년 전 | 362 | ||
| 7839 | 9년 전 | 395 | ||
| 7838 | 9년 전 | 479 | ||
| 7837 | 9년 전 | 320 | ||
| 7836 | 9년 전 | 360 | ||
| 7835 | 9년 전 | 442 | ||
| 7834 |
|
9년 전 | 1169 | |
| 7833 | 9년 전 | 374 | ||
| 7832 | 9년 전 | 371 | ||
| 7831 | 9년 전 | 505 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기