<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 62 | ||
| 8229 | 9년 전 | 62 | ||
| 8228 |
커네드커네드
|
9년 전 | 108 | |
| 8227 | 9년 전 | 115 | ||
| 8226 | 9년 전 | 155 | ||
| 8225 | 9년 전 | 142 | ||
| 8224 | 9년 전 | 141 | ||
| 8223 | 9년 전 | 110 | ||
| 8222 |
|
9년 전 | 174 | |
| 8221 | 9년 전 | 81 | ||
| 8220 | 9년 전 | 91 | ||
| 8219 | 9년 전 | 94 | ||
| 8218 | 9년 전 | 128 | ||
| 8217 |
star3840
|
9년 전 | 104 | |
| 8216 | 9년 전 | 155 | ||
| 8215 | 9년 전 | 101 | ||
| 8214 | 9년 전 | 218 | ||
| 8213 | 9년 전 | 149 | ||
| 8212 | 9년 전 | 77 | ||
| 8211 | 9년 전 | 236 | ||
| 8210 | 9년 전 | 237 | ||
| 8209 | 9년 전 | 328 | ||
| 8208 | 9년 전 | 206 | ||
| 8207 | 9년 전 | 217 | ||
| 8206 |
|
9년 전 | 176 | |
| 8205 | 9년 전 | 161 | ||
| 8204 | 9년 전 | 123 | ||
| 8203 | 9년 전 | 224 | ||
| 8202 | 9년 전 | 134 | ||
| 8201 | 9년 전 | 173 | ||
| 8200 | 9년 전 | 150 | ||
| 8199 | 9년 전 | 199 | ||
| 8198 | 9년 전 | 166 | ||
| 8197 | 9년 전 | 153 | ||
| 8196 | 9년 전 | 543 | ||
| 8195 | 9년 전 | 148 | ||
| 8194 | 9년 전 | 276 | ||
| 8193 | 9년 전 | 150 | ||
| 8192 | 9년 전 | 177 | ||
| 8191 | 9년 전 | 130 | ||
| 8190 | 9년 전 | 122 | ||
| 8189 | 9년 전 | 180 | ||
| 8188 | 9년 전 | 123 | ||
| 8187 | 9년 전 | 133 | ||
| 8186 | 9년 전 | 136 | ||
| 8185 | 9년 전 | 302 | ||
| 8184 | 9년 전 | 99 | ||
| 8183 | 9년 전 | 317 | ||
| 8182 | 9년 전 | 159 | ||
| 8181 | 9년 전 | 121 | ||
| 8180 | 9년 전 | 688 | ||
| 8179 | 9년 전 | 479 | ||
| 8178 | 9년 전 | 299 | ||
| 8177 |
kiplayer
|
9년 전 | 305 | |
| 8176 | 9년 전 | 342 | ||
| 8175 | 9년 전 | 212 | ||
| 8174 | 9년 전 | 230 | ||
| 8173 | 9년 전 | 338 | ||
| 8172 | 9년 전 | 186 | ||
| 8171 | 9년 전 | 176 | ||
| 8170 | 9년 전 | 287 | ||
| 8169 |
커네드커네드
|
9년 전 | 251 | |
| 8168 | 9년 전 | 311 | ||
| 8167 | 9년 전 | 312 | ||
| 8166 | 9년 전 | 227 | ||
| 8165 | 9년 전 | 157 | ||
| 8164 | 9년 전 | 296 | ||
| 8163 | 9년 전 | 277 | ||
| 8162 | 9년 전 | 290 | ||
| 8161 | 9년 전 | 284 | ||
| 8160 |
|
9년 전 | 481 | |
| 8159 | 9년 전 | 414 | ||
| 8158 | 9년 전 | 231 | ||
| 8157 | 9년 전 | 365 | ||
| 8156 | 9년 전 | 272 | ||
| 8155 | 9년 전 | 245 | ||
| 8154 |
00년생용띠
|
9년 전 | 594 | |
| 8153 | 9년 전 | 222 | ||
| 8152 |
|
9년 전 | 396 | |
| 8151 | 9년 전 | 398 | ||
| 8150 | 9년 전 | 492 | ||
| 8149 |
Jangfolk
|
9년 전 | 335 | |
| 8148 | 9년 전 | 158 | ||
| 8147 | 9년 전 | 366 | ||
| 8146 | 9년 전 | 425 | ||
| 8145 | 9년 전 | 369 | ||
| 8144 | 9년 전 | 336 | ||
| 8143 | 9년 전 | 183 | ||
| 8142 | 9년 전 | 422 | ||
| 8141 | 9년 전 | 372 | ||
| 8140 | 9년 전 | 920 | ||
| 8139 | 9년 전 | 252 | ||
| 8138 |
전갈자리남자
|
9년 전 | 380 | |
| 8137 | 9년 전 | 381 | ||
| 8136 | 9년 전 | 736 | ||
| 8135 |
|
9년 전 | 785 | |
| 8134 |
PlayPixel
|
9년 전 | 503 | |
| 8133 |
|
9년 전 | 428 | |
| 8132 | 9년 전 | 440 | ||
| 8131 | 9년 전 | 803 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기