<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년 전 | 4118 | ||
| 429 | 19년 전 | 3313 | ||
| 428 | 19년 전 | 4135 | ||
| 427 | 19년 전 | 3482 | ||
| 426 | 19년 전 | 3108 | ||
| 425 | 19년 전 | 3413 | ||
| 424 | 19년 전 | 2442 | ||
| 423 | 19년 전 | 2869 | ||
| 422 | 19년 전 | 2358 | ||
| 421 | 19년 전 | 3710 | ||
| 420 | 19년 전 | 4745 | ||
| 419 | 19년 전 | 3814 | ||
| 418 |
|
19년 전 | 1755 | |
| 417 | 19년 전 | 2757 | ||
| 416 | 19년 전 | 2398 | ||
| 415 | 19년 전 | 2612 | ||
| 414 | 19년 전 | 4418 | ||
| 413 |
|
19년 전 | 2613 | |
| 412 | 19년 전 | 3058 | ||
| 411 |
|
19년 전 | 2998 | |
| 410 |
|
19년 전 | 3697 | |
| 409 |
|
19년 전 | 3644 | |
| 408 |
|
19년 전 | 1861 | |
| 407 | 19년 전 | 2238 | ||
| 406 | 19년 전 | 2795 | ||
| 405 | 19년 전 | 2461 | ||
| 404 | 19년 전 | 4315 | ||
| 403 | 19년 전 | 3307 | ||
| 402 |
NeoGenesis
|
19년 전 | 4102 | |
| 401 | 19년 전 | 2613 | ||
| 400 |
|
19년 전 | 2504 | |
| 399 | 19년 전 | 2965 | ||
| 398 | 19년 전 | 2496 | ||
| 397 | 19년 전 | 2789 | ||
| 396 | 19년 전 | 2493 | ||
| 395 | 19년 전 | 3198 | ||
| 394 | 19년 전 | 1738 | ||
| 393 | 19년 전 | 2999 | ||
| 392 | 19년 전 | 2273 | ||
| 391 | 19년 전 | 2185 | ||
| 390 | 19년 전 | 2294 | ||
| 389 | 19년 전 | 2649 | ||
| 388 | 19년 전 | 2193 | ||
| 387 | 19년 전 | 4489 | ||
| 386 |
|
19년 전 | 2696 | |
| 385 |
|
19년 전 | 2496 | |
| 384 | 19년 전 | 3031 | ||
| 383 | 19년 전 | 3065 | ||
| 382 | 19년 전 | 3116 | ||
| 381 |
|
19년 전 | 2641 | |
| 380 |
|
19년 전 | 3028 | |
| 379 | 19년 전 | 2552 | ||
| 378 | 19년 전 | 2217 | ||
| 377 | 19년 전 | 2786 | ||
| 376 | 19년 전 | 2475 | ||
| 375 |
|
19년 전 | 2569 | |
| 374 | 19년 전 | 3825 | ||
| 373 | 19년 전 | 3278 | ||
| 372 | 19년 전 | 5000 | ||
| 371 |
세은아빠2
|
19년 전 | 2421 | |
| 370 | 19년 전 | 4506 | ||
| 369 | 19년 전 | 3110 | ||
| 368 | 19년 전 | 2913 | ||
| 367 | 19년 전 | 3735 | ||
| 366 | 19년 전 | 2662 | ||
| 365 | 19년 전 | 3750 | ||
| 364 | 19년 전 | 4023 | ||
| 363 | 19년 전 | 3453 | ||
| 362 | 19년 전 | 3490 | ||
| 361 | 19년 전 | 4111 | ||
| 360 |
hwatta
|
19년 전 | 2372 | |
| 359 | 19년 전 | 5114 | ||
| 358 | 19년 전 | 3662 | ||
| 357 | 19년 전 | 2611 | ||
| 356 |
sdesign1s
|
20년 전 | 2288 | |
| 355 | 20년 전 | 2766 | ||
| 354 | 20년 전 | 3031 | ||
| 353 | 20년 전 | 2801 | ||
| 352 |
|
20년 전 | 5779 | |
| 351 |
|
20년 전 | 2712 | |
| 350 |
|
20년 전 | 4302 | |
| 349 |
hwatta
|
20년 전 | 2192 | |
| 348 | 20년 전 | 7312 | ||
| 347 | 20년 전 | 2420 | ||
| 346 | 20년 전 | 3511 | ||
| 345 | 20년 전 | 4319 | ||
| 344 | 20년 전 | 2660 | ||
| 343 | 20년 전 | 3926 | ||
| 342 | 20년 전 | 3074 | ||
| 341 | 20년 전 | 4104 | ||
| 340 |
|
20년 전 | 5153 | |
| 339 |
|
20년 전 | 4241 | |
| 338 | 20년 전 | 5884 | ||
| 337 | 20년 전 | 2051 | ||
| 336 |
|
20년 전 | 3332 | |
| 335 |
|
20년 전 | 3550 | |
| 334 |
|
20년 전 | 2946 | |
| 333 |
hwatta
|
20년 전 | 2445 | |
| 332 | 20년 전 | 4661 | ||
| 331 | 20년 전 | 2285 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기