<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7830 | 9년 전 | 424 | ||
| 7829 |
|
9년 전 | 618 | |
| 7828 | 9년 전 | 543 | ||
| 7827 | 9년 전 | 436 | ||
| 7826 | 9년 전 | 437 | ||
| 7825 | 10년 전 | 482 | ||
| 7824 | 10년 전 | 447 | ||
| 7823 | 10년 전 | 384 | ||
| 7822 | 10년 전 | 364 | ||
| 7821 | 10년 전 | 314 | ||
| 7820 | 10년 전 | 351 | ||
| 7819 |
|
10년 전 | 752 | |
| 7818 | 10년 전 | 395 | ||
| 7817 | 10년 전 | 523 | ||
| 7816 | 10년 전 | 412 | ||
| 7815 | 10년 전 | 610 | ||
| 7814 | 10년 전 | 436 | ||
| 7813 | 10년 전 | 378 | ||
| 7812 | 10년 전 | 404 | ||
| 7811 | 10년 전 | 395 | ||
| 7810 | 10년 전 | 568 | ||
| 7809 | 10년 전 | 501 | ||
| 7808 | 10년 전 | 380 | ||
| 7807 | 10년 전 | 408 | ||
| 7806 |
프로그래머7
|
10년 전 | 1335 | |
| 7805 | 10년 전 | 1277 | ||
| 7804 |
zahir1312
|
10년 전 | 780 | |
| 7803 |
|
10년 전 | 1376 | |
| 7802 | 10년 전 | 461 | ||
| 7801 | 10년 전 | 864 | ||
| 7800 | 10년 전 | 1087 | ||
| 7799 | 10년 전 | 561 | ||
| 7798 | 10년 전 | 515 | ||
| 7797 | 10년 전 | 515 | ||
| 7796 | 10년 전 | 357 | ||
| 7795 | 10년 전 | 507 | ||
| 7794 | 10년 전 | 560 | ||
| 7793 | 10년 전 | 1061 | ||
| 7792 | 10년 전 | 478 | ||
| 7791 | 10년 전 | 558 | ||
| 7790 | 10년 전 | 509 | ||
| 7789 |
fbastore
|
10년 전 | 1449 | |
| 7788 | 10년 전 | 547 | ||
| 7787 | 10년 전 | 403 | ||
| 7786 | 10년 전 | 597 | ||
| 7785 | 10년 전 | 587 | ||
| 7784 | 10년 전 | 649 | ||
| 7783 | 10년 전 | 454 | ||
| 7782 | 10년 전 | 494 | ||
| 7781 | 10년 전 | 901 | ||
| 7780 | 10년 전 | 819 | ||
| 7779 | 10년 전 | 777 | ||
| 7778 | 10년 전 | 365 | ||
| 7777 | 10년 전 | 459 | ||
| 7776 | 10년 전 | 462 | ||
| 7775 | 10년 전 | 412 | ||
| 7774 | 10년 전 | 631 | ||
| 7773 | 10년 전 | 386 | ||
| 7772 | 10년 전 | 738 | ||
| 7771 | 10년 전 | 392 | ||
| 7770 | 10년 전 | 648 | ||
| 7769 | 10년 전 | 388 | ||
| 7768 | 10년 전 | 615 | ||
| 7767 | 10년 전 | 1175 | ||
| 7766 | 10년 전 | 492 | ||
| 7765 | 10년 전 | 531 | ||
| 7764 |
잘살아보자
|
10년 전 | 394 | |
| 7763 |
|
10년 전 | 1462 | |
| 7762 |
Tosea
|
10년 전 | 1058 | |
| 7761 | 10년 전 | 651 | ||
| 7760 |
잘살아보자
|
10년 전 | 683 | |
| 7759 |
잘살아보자
|
10년 전 | 514 | |
| 7758 |
잘살아보자
|
10년 전 | 596 | |
| 7757 | 10년 전 | 1247 | ||
| 7756 |
ITBANK
|
10년 전 | 1257 | |
| 7755 | 10년 전 | 1930 | ||
| 7754 | 10년 전 | 1057 | ||
| 7753 | 10년 전 | 886 | ||
| 7752 | 10년 전 | 1396 | ||
| 7751 |
잘살아보자
|
10년 전 | 537 | |
| 7750 |
잘살아보자
|
10년 전 | 481 | |
| 7749 |
잘살아보자
|
10년 전 | 493 | |
| 7748 |
잘살아보자
|
10년 전 | 499 | |
| 7747 |
잘살아보자
|
10년 전 | 592 | |
| 7746 |
잘살아보자
|
10년 전 | 683 | |
| 7745 |
잘살아보자
|
10년 전 | 920 | |
| 7744 |
잘살아보자
|
10년 전 | 419 | |
| 7743 | 10년 전 | 948 | ||
| 7742 |
starbros
|
10년 전 | 843 | |
| 7741 |
잘살아보자
|
10년 전 | 677 | |
| 7740 |
잘살아보자
|
10년 전 | 548 | |
| 7739 |
잘살아보자
|
10년 전 | 466 | |
| 7738 |
잘살아보자
|
10년 전 | 537 | |
| 7737 |
잘살아보자
|
10년 전 | 506 | |
| 7736 |
잘살아보자
|
10년 전 | 524 | |
| 7735 |
잘살아보자
|
10년 전 | 854 | |
| 7734 |
잘살아보자
|
10년 전 | 434 | |
| 7733 |
잘살아보자
|
10년 전 | 546 | |
| 7732 |
잘살아보자
|
10년 전 | 702 | |
| 7731 |
잘살아보자
|
10년 전 | 627 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기