<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4089 | ||
| 429 | 19년 전 | 3286 | ||
| 428 | 19년 전 | 4121 | ||
| 427 | 19년 전 | 3464 | ||
| 426 | 19년 전 | 3096 | ||
| 425 | 19년 전 | 3389 | ||
| 424 | 19년 전 | 2432 | ||
| 423 | 19년 전 | 2844 | ||
| 422 | 19년 전 | 2334 | ||
| 421 | 19년 전 | 3701 | ||
| 420 | 19년 전 | 4727 | ||
| 419 | 19년 전 | 3779 | ||
| 418 |
|
19년 전 | 1726 | |
| 417 | 19년 전 | 2733 | ||
| 416 | 19년 전 | 2381 | ||
| 415 | 19년 전 | 2601 | ||
| 414 | 19년 전 | 4396 | ||
| 413 |
|
19년 전 | 2582 | |
| 412 | 19년 전 | 3030 | ||
| 411 |
|
19년 전 | 2978 | |
| 410 |
|
19년 전 | 3665 | |
| 409 |
|
19년 전 | 3623 | |
| 408 |
|
19년 전 | 1842 | |
| 407 | 19년 전 | 2213 | ||
| 406 | 19년 전 | 2768 | ||
| 405 | 19년 전 | 2434 | ||
| 404 | 19년 전 | 4291 | ||
| 403 | 19년 전 | 3290 | ||
| 402 |
NeoGenesis
|
19년 전 | 4082 | |
| 401 | 19년 전 | 2594 | ||
| 400 |
|
19년 전 | 2479 | |
| 399 | 19년 전 | 2942 | ||
| 398 | 19년 전 | 2474 | ||
| 397 | 19년 전 | 2774 | ||
| 396 | 19년 전 | 2461 | ||
| 395 | 19년 전 | 3167 | ||
| 394 | 19년 전 | 1704 | ||
| 393 | 19년 전 | 2980 | ||
| 392 | 19년 전 | 2240 | ||
| 391 | 19년 전 | 2171 | ||
| 390 | 19년 전 | 2268 | ||
| 389 | 19년 전 | 2634 | ||
| 388 | 19년 전 | 2131 | ||
| 387 | 19년 전 | 4469 | ||
| 386 |
|
19년 전 | 2673 | |
| 385 |
|
19년 전 | 2465 | |
| 384 | 19년 전 | 2987 | ||
| 383 | 19년 전 | 3037 | ||
| 382 | 19년 전 | 3089 | ||
| 381 |
|
19년 전 | 2624 | |
| 380 |
|
19년 전 | 3003 | |
| 379 | 19년 전 | 2540 | ||
| 378 | 19년 전 | 2198 | ||
| 377 | 19년 전 | 2772 | ||
| 376 | 19년 전 | 2463 | ||
| 375 |
|
19년 전 | 2548 | |
| 374 | 19년 전 | 3799 | ||
| 373 | 19년 전 | 3258 | ||
| 372 | 19년 전 | 4976 | ||
| 371 |
세은아빠2
|
19년 전 | 2403 | |
| 370 | 19년 전 | 4494 | ||
| 369 | 19년 전 | 3095 | ||
| 368 | 19년 전 | 2882 | ||
| 367 | 19년 전 | 3717 | ||
| 366 | 19년 전 | 2629 | ||
| 365 | 19년 전 | 3721 | ||
| 364 | 19년 전 | 3999 | ||
| 363 | 19년 전 | 3425 | ||
| 362 | 19년 전 | 3469 | ||
| 361 | 19년 전 | 4089 | ||
| 360 |
hwatta
|
19년 전 | 2347 | |
| 359 | 19년 전 | 5088 | ||
| 358 | 19년 전 | 3640 | ||
| 357 | 19년 전 | 2583 | ||
| 356 |
sdesign1s
|
19년 전 | 2265 | |
| 355 | 20년 전 | 2732 | ||
| 354 | 20년 전 | 3017 | ||
| 353 | 20년 전 | 2782 | ||
| 352 |
|
20년 전 | 5761 | |
| 351 |
|
20년 전 | 2691 | |
| 350 |
|
20년 전 | 4273 | |
| 349 |
hwatta
|
20년 전 | 2171 | |
| 348 | 20년 전 | 7298 | ||
| 347 | 20년 전 | 2404 | ||
| 346 | 20년 전 | 3490 | ||
| 345 | 20년 전 | 4292 | ||
| 344 | 20년 전 | 2621 | ||
| 343 | 20년 전 | 3907 | ||
| 342 | 20년 전 | 3051 | ||
| 341 | 20년 전 | 4076 | ||
| 340 |
|
20년 전 | 5112 | |
| 339 |
|
20년 전 | 4219 | |
| 338 | 20년 전 | 5848 | ||
| 337 | 20년 전 | 2023 | ||
| 336 |
|
20년 전 | 3301 | |
| 335 |
|
20년 전 | 3526 | |
| 334 |
|
20년 전 | 2908 | |
| 333 |
hwatta
|
20년 전 | 2422 | |
| 332 | 20년 전 | 4643 | ||
| 331 | 20년 전 | 2259 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기