<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년 전 | 4132 | ||
| 429 | 19년 전 | 3325 | ||
| 428 | 19년 전 | 4145 | ||
| 427 | 19년 전 | 3493 | ||
| 426 | 19년 전 | 3120 | ||
| 425 | 19년 전 | 3430 | ||
| 424 | 19년 전 | 2453 | ||
| 423 | 19년 전 | 2881 | ||
| 422 | 19년 전 | 2374 | ||
| 421 | 19년 전 | 3726 | ||
| 420 | 19년 전 | 4755 | ||
| 419 | 19년 전 | 3832 | ||
| 418 |
|
19년 전 | 1767 | |
| 417 | 19년 전 | 2767 | ||
| 416 | 19년 전 | 2411 | ||
| 415 | 19년 전 | 2615 | ||
| 414 | 19년 전 | 4431 | ||
| 413 |
|
19년 전 | 2626 | |
| 412 | 19년 전 | 3067 | ||
| 411 |
|
19년 전 | 3003 | |
| 410 |
|
19년 전 | 3711 | |
| 409 |
|
19년 전 | 3653 | |
| 408 |
|
19년 전 | 1876 | |
| 407 | 19년 전 | 2245 | ||
| 406 | 19년 전 | 2812 | ||
| 405 | 19년 전 | 2477 | ||
| 404 | 19년 전 | 4324 | ||
| 403 | 19년 전 | 3315 | ||
| 402 |
NeoGenesis
|
19년 전 | 4112 | |
| 401 | 19년 전 | 2622 | ||
| 400 |
|
19년 전 | 2528 | |
| 399 | 19년 전 | 2979 | ||
| 398 | 19년 전 | 2513 | ||
| 397 | 19년 전 | 2809 | ||
| 396 | 19년 전 | 2510 | ||
| 395 | 19년 전 | 3220 | ||
| 394 | 19년 전 | 1761 | ||
| 393 | 19년 전 | 3014 | ||
| 392 | 19년 전 | 2291 | ||
| 391 | 19년 전 | 2193 | ||
| 390 | 19년 전 | 2304 | ||
| 389 | 19년 전 | 2666 | ||
| 388 | 19년 전 | 2211 | ||
| 387 | 19년 전 | 4495 | ||
| 386 |
|
19년 전 | 2703 | |
| 385 |
|
19년 전 | 2512 | |
| 384 | 19년 전 | 3052 | ||
| 383 | 19년 전 | 3079 | ||
| 382 | 19년 전 | 3125 | ||
| 381 |
|
19년 전 | 2652 | |
| 380 |
|
19년 전 | 3034 | |
| 379 | 19년 전 | 2562 | ||
| 378 | 19년 전 | 2232 | ||
| 377 | 19년 전 | 2794 | ||
| 376 | 19년 전 | 2482 | ||
| 375 |
|
19년 전 | 2579 | |
| 374 | 19년 전 | 3837 | ||
| 373 | 19년 전 | 3289 | ||
| 372 | 19년 전 | 5013 | ||
| 371 |
세은아빠2
|
19년 전 | 2435 | |
| 370 | 19년 전 | 4515 | ||
| 369 | 19년 전 | 3121 | ||
| 368 | 19년 전 | 2920 | ||
| 367 | 19년 전 | 3747 | ||
| 366 | 19년 전 | 2673 | ||
| 365 | 19년 전 | 3760 | ||
| 364 | 19년 전 | 4036 | ||
| 363 | 19년 전 | 3472 | ||
| 362 | 20년 전 | 3503 | ||
| 361 | 20년 전 | 4129 | ||
| 360 |
hwatta
|
20년 전 | 2383 | |
| 359 | 20년 전 | 5127 | ||
| 358 | 20년 전 | 3675 | ||
| 357 | 20년 전 | 2621 | ||
| 356 |
sdesign1s
|
20년 전 | 2300 | |
| 355 | 20년 전 | 2778 | ||
| 354 | 20년 전 | 3042 | ||
| 353 | 20년 전 | 2809 | ||
| 352 |
|
20년 전 | 5792 | |
| 351 |
|
20년 전 | 2727 | |
| 350 |
|
20년 전 | 4314 | |
| 349 |
hwatta
|
20년 전 | 2213 | |
| 348 | 20년 전 | 7322 | ||
| 347 | 20년 전 | 2427 | ||
| 346 | 20년 전 | 3525 | ||
| 345 | 20년 전 | 4330 | ||
| 344 | 20년 전 | 2674 | ||
| 343 | 20년 전 | 3939 | ||
| 342 | 20년 전 | 3085 | ||
| 341 | 20년 전 | 4115 | ||
| 340 |
|
20년 전 | 5172 | |
| 339 |
|
20년 전 | 4254 | |
| 338 | 20년 전 | 5898 | ||
| 337 | 20년 전 | 2061 | ||
| 336 |
|
20년 전 | 3354 | |
| 335 |
|
20년 전 | 3570 | |
| 334 |
|
20년 전 | 2964 | |
| 333 |
hwatta
|
20년 전 | 2469 | |
| 332 | 20년 전 | 4673 | ||
| 331 | 20년 전 | 2296 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기