<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 130 | 20년 전 | 3972 | ||
| 129 | 20년 전 | 2913 | ||
| 128 | 20년 전 | 3649 | ||
| 127 | 20년 전 | 3459 | ||
| 126 | 20년 전 | 3733 | ||
| 125 | 20년 전 | 8564 | ||
| 124 | 20년 전 | 2589 | ||
| 123 | 20년 전 | 3735 | ||
| 122 | 20년 전 | 3194 | ||
| 121 | 20년 전 | 2595 | ||
| 120 | 20년 전 | 2653 | ||
| 119 | 20년 전 | 2568 | ||
| 118 | 20년 전 | 2854 | ||
| 117 |
|
20년 전 | 3040 | |
| 116 | 20년 전 | 5290 | ||
| 115 | 20년 전 | 3901 | ||
| 114 | 20년 전 | 4950 | ||
| 113 | 20년 전 | 6196 | ||
| 112 | 20년 전 | 7317 | ||
| 111 | 20년 전 | 18422 | ||
| 110 | 20년 전 | 6868 | ||
| 109 | 20년 전 | 2868 | ||
| 108 | 20년 전 | 4127 | ||
| 107 |
prosper
|
20년 전 | 2477 | |
| 106 |
prosper
|
20년 전 | 4302 | |
| 105 |
아우겐나이스
|
20년 전 | 2896 | |
| 104 | 20년 전 | 2249 | ||
| 103 | 20년 전 | 2466 | ||
| 102 | 20년 전 | 2227 | ||
| 101 | 20년 전 | 2556 | ||
| 100 | 20년 전 | 1736 | ||
| 99 | 20년 전 | 1558 | ||
| 98 | 20년 전 | 1609 | ||
| 97 | 20년 전 | 2113 | ||
| 96 | 20년 전 | 1863 | ||
| 95 | 20년 전 | 2362 | ||
| 94 | 20년 전 | 3549 | ||
| 93 | 20년 전 | 1547 | ||
| 92 | 20년 전 | 1745 | ||
| 91 | 20년 전 | 3161 | ||
| 90 | 20년 전 | 2334 | ||
| 89 | 20년 전 | 3158 | ||
| 88 | 20년 전 | 2859 | ||
| 87 | 20년 전 | 3284 | ||
| 86 | 20년 전 | 5109 | ||
| 85 | 20년 전 | 2509 | ||
| 84 | 20년 전 | 4812 | ||
| 83 | 20년 전 | 2491 | ||
| 82 | 20년 전 | 3106 | ||
| 81 | 20년 전 | 7610 | ||
| 80 | 20년 전 | 3808 | ||
| 79 | 20년 전 | 3198 | ||
| 78 | 20년 전 | 4680 | ||
| 77 | 20년 전 | 2886 | ||
| 76 | 20년 전 | 6206 | ||
| 75 | 20년 전 | 4462 | ||
| 74 | 20년 전 | 5771 | ||
| 73 | 20년 전 | 3617 | ||
| 72 | 20년 전 | 5956 | ||
| 71 | 20년 전 | 3098 | ||
| 70 | 20년 전 | 2827 | ||
| 69 | 20년 전 | 2623 | ||
| 68 | 20년 전 | 2432 | ||
| 67 | 20년 전 | 2640 | ||
| 66 | 20년 전 | 2659 | ||
| 65 | 20년 전 | 3779 | ||
| 64 | 20년 전 | 2813 | ||
| 63 | 20년 전 | 2445 | ||
| 62 | 20년 전 | 2251 | ||
| 61 | 20년 전 | 3050 | ||
| 60 | 20년 전 | 3122 | ||
| 59 | 20년 전 | 2501 | ||
| 58 | 20년 전 | 2582 | ||
| 57 | 20년 전 | 2955 | ||
| 56 | 20년 전 | 2300 | ||
| 55 | 20년 전 | 2745 | ||
| 54 | 20년 전 | 2112 | ||
| 53 | 20년 전 | 2337 | ||
| 52 | 20년 전 | 2685 | ||
| 51 |
prosper
|
20년 전 | 2336 | |
| 50 |
prosper
|
20년 전 | 2155 | |
| 49 | 20년 전 | 2163 | ||
| 48 | 20년 전 | 2317 | ||
| 47 | 20년 전 | 1917 | ||
| 46 | 20년 전 | 1917 | ||
| 45 | 20년 전 | 2124 | ||
| 44 | 20년 전 | 2350 | ||
| 43 | 21년 전 | 4564 | ||
| 42 |
prosper
|
21년 전 | 2702 | |
| 41 |
prosper
|
21년 전 | 2104 | |
| 40 | 21년 전 | 2169 | ||
| 39 | 21년 전 | 2135 | ||
| 38 | 21년 전 | 2404 | ||
| 37 | 21년 전 | 2551 | ||
| 36 | 21년 전 | 1766 | ||
| 35 | 21년 전 | 4062 | ||
| 34 | 21년 전 | 3839 | ||
| 33 | 21년 전 | 2981 | ||
| 32 |
prosper
|
21년 전 | 2889 | |
| 31 | 21년 전 | 5262 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기