<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년 전 | 410 | ||
| 7829 |
|
9년 전 | 591 | |
| 7828 | 9년 전 | 523 | ||
| 7827 | 9년 전 | 412 | ||
| 7826 | 9년 전 | 419 | ||
| 7825 | 10년 전 | 461 | ||
| 7824 | 10년 전 | 436 | ||
| 7823 | 10년 전 | 358 | ||
| 7822 | 10년 전 | 342 | ||
| 7821 | 10년 전 | 298 | ||
| 7820 | 10년 전 | 340 | ||
| 7819 |
|
10년 전 | 743 | |
| 7818 | 10년 전 | 376 | ||
| 7817 | 10년 전 | 496 | ||
| 7816 | 10년 전 | 394 | ||
| 7815 | 10년 전 | 596 | ||
| 7814 | 10년 전 | 415 | ||
| 7813 | 10년 전 | 363 | ||
| 7812 | 10년 전 | 381 | ||
| 7811 | 10년 전 | 383 | ||
| 7810 | 10년 전 | 551 | ||
| 7809 | 10년 전 | 475 | ||
| 7808 | 10년 전 | 368 | ||
| 7807 | 10년 전 | 394 | ||
| 7806 |
프로그래머7
|
10년 전 | 1325 | |
| 7805 | 10년 전 | 1264 | ||
| 7804 |
zahir1312
|
10년 전 | 766 | |
| 7803 |
|
10년 전 | 1361 | |
| 7802 | 10년 전 | 449 | ||
| 7801 | 10년 전 | 854 | ||
| 7800 | 10년 전 | 1077 | ||
| 7799 | 10년 전 | 539 | ||
| 7798 | 10년 전 | 493 | ||
| 7797 | 10년 전 | 492 | ||
| 7796 | 10년 전 | 335 | ||
| 7795 | 10년 전 | 492 | ||
| 7794 | 10년 전 | 531 | ||
| 7793 | 10년 전 | 1041 | ||
| 7792 | 10년 전 | 452 | ||
| 7791 | 10년 전 | 533 | ||
| 7790 | 10년 전 | 494 | ||
| 7789 |
fbastore
|
10년 전 | 1436 | |
| 7788 | 10년 전 | 529 | ||
| 7787 | 10년 전 | 388 | ||
| 7786 | 10년 전 | 562 | ||
| 7785 | 10년 전 | 566 | ||
| 7784 | 10년 전 | 627 | ||
| 7783 | 10년 전 | 428 | ||
| 7782 | 10년 전 | 479 | ||
| 7781 | 10년 전 | 888 | ||
| 7780 | 10년 전 | 804 | ||
| 7779 | 10년 전 | 768 | ||
| 7778 | 10년 전 | 355 | ||
| 7777 | 10년 전 | 440 | ||
| 7776 | 10년 전 | 445 | ||
| 7775 | 10년 전 | 388 | ||
| 7774 | 10년 전 | 623 | ||
| 7773 | 10년 전 | 371 | ||
| 7772 | 10년 전 | 718 | ||
| 7771 | 10년 전 | 365 | ||
| 7770 | 10년 전 | 635 | ||
| 7769 | 10년 전 | 364 | ||
| 7768 | 10년 전 | 589 | ||
| 7767 | 10년 전 | 1157 | ||
| 7766 | 10년 전 | 485 | ||
| 7765 | 10년 전 | 507 | ||
| 7764 |
잘살아보자
|
10년 전 | 367 | |
| 7763 |
|
10년 전 | 1436 | |
| 7762 |
Tosea
|
10년 전 | 1046 | |
| 7761 | 10년 전 | 634 | ||
| 7760 |
잘살아보자
|
10년 전 | 665 | |
| 7759 |
잘살아보자
|
10년 전 | 488 | |
| 7758 |
잘살아보자
|
10년 전 | 578 | |
| 7757 | 10년 전 | 1229 | ||
| 7756 |
ITBANK
|
10년 전 | 1245 | |
| 7755 | 10년 전 | 1920 | ||
| 7754 | 10년 전 | 1042 | ||
| 7753 | 10년 전 | 872 | ||
| 7752 | 10년 전 | 1381 | ||
| 7751 |
잘살아보자
|
10년 전 | 512 | |
| 7750 |
잘살아보자
|
10년 전 | 468 | |
| 7749 |
잘살아보자
|
10년 전 | 468 | |
| 7748 |
잘살아보자
|
10년 전 | 465 | |
| 7747 |
잘살아보자
|
10년 전 | 561 | |
| 7746 |
잘살아보자
|
10년 전 | 671 | |
| 7745 |
잘살아보자
|
10년 전 | 901 | |
| 7744 |
잘살아보자
|
10년 전 | 407 | |
| 7743 | 10년 전 | 938 | ||
| 7742 |
starbros
|
10년 전 | 825 | |
| 7741 |
잘살아보자
|
10년 전 | 659 | |
| 7740 |
잘살아보자
|
10년 전 | 515 | |
| 7739 |
잘살아보자
|
10년 전 | 454 | |
| 7738 |
잘살아보자
|
10년 전 | 520 | |
| 7737 |
잘살아보자
|
10년 전 | 484 | |
| 7736 |
잘살아보자
|
10년 전 | 504 | |
| 7735 |
잘살아보자
|
10년 전 | 834 | |
| 7734 |
잘살아보자
|
10년 전 | 422 | |
| 7733 |
잘살아보자
|
10년 전 | 532 | |
| 7732 |
잘살아보자
|
10년 전 | 686 | |
| 7731 |
잘살아보자
|
10년 전 | 605 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기