<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 83 | ||
| 8229 | 9년 전 | 78 | ||
| 8228 |
커네드커네드
|
9년 전 | 118 | |
| 8227 | 9년 전 | 133 | ||
| 8226 | 9년 전 | 169 | ||
| 8225 | 9년 전 | 157 | ||
| 8224 | 9년 전 | 151 | ||
| 8223 | 9년 전 | 119 | ||
| 8222 |
|
9년 전 | 197 | |
| 8221 | 9년 전 | 98 | ||
| 8220 | 9년 전 | 110 | ||
| 8219 | 9년 전 | 108 | ||
| 8218 | 9년 전 | 153 | ||
| 8217 |
star3840
|
9년 전 | 117 | |
| 8216 | 9년 전 | 167 | ||
| 8215 | 9년 전 | 124 | ||
| 8214 | 9년 전 | 231 | ||
| 8213 | 9년 전 | 167 | ||
| 8212 | 9년 전 | 87 | ||
| 8211 | 9년 전 | 256 | ||
| 8210 | 9년 전 | 254 | ||
| 8209 | 9년 전 | 344 | ||
| 8208 | 9년 전 | 231 | ||
| 8207 | 9년 전 | 235 | ||
| 8206 |
|
9년 전 | 196 | |
| 8205 | 9년 전 | 176 | ||
| 8204 | 9년 전 | 139 | ||
| 8203 | 9년 전 | 238 | ||
| 8202 | 9년 전 | 151 | ||
| 8201 | 9년 전 | 187 | ||
| 8200 | 9년 전 | 171 | ||
| 8199 | 9년 전 | 223 | ||
| 8198 | 9년 전 | 181 | ||
| 8197 | 9년 전 | 171 | ||
| 8196 | 9년 전 | 559 | ||
| 8195 | 9년 전 | 167 | ||
| 8194 | 9년 전 | 291 | ||
| 8193 | 9년 전 | 163 | ||
| 8192 | 9년 전 | 203 | ||
| 8191 | 9년 전 | 150 | ||
| 8190 | 9년 전 | 139 | ||
| 8189 | 9년 전 | 199 | ||
| 8188 | 9년 전 | 135 | ||
| 8187 | 9년 전 | 152 | ||
| 8186 | 9년 전 | 150 | ||
| 8185 | 9년 전 | 321 | ||
| 8184 | 9년 전 | 113 | ||
| 8183 | 9년 전 | 333 | ||
| 8182 | 9년 전 | 174 | ||
| 8181 | 9년 전 | 138 | ||
| 8180 | 9년 전 | 705 | ||
| 8179 | 9년 전 | 493 | ||
| 8178 | 9년 전 | 317 | ||
| 8177 |
kiplayer
|
9년 전 | 335 | |
| 8176 | 9년 전 | 359 | ||
| 8175 | 9년 전 | 230 | ||
| 8174 | 9년 전 | 257 | ||
| 8173 | 9년 전 | 350 | ||
| 8172 | 9년 전 | 207 | ||
| 8171 | 9년 전 | 189 | ||
| 8170 | 9년 전 | 300 | ||
| 8169 |
커네드커네드
|
9년 전 | 263 | |
| 8168 | 9년 전 | 328 | ||
| 8167 | 9년 전 | 326 | ||
| 8166 | 9년 전 | 245 | ||
| 8165 | 9년 전 | 177 | ||
| 8164 | 9년 전 | 308 | ||
| 8163 | 9년 전 | 294 | ||
| 8162 | 9년 전 | 308 | ||
| 8161 | 9년 전 | 302 | ||
| 8160 |
|
9년 전 | 500 | |
| 8159 | 9년 전 | 435 | ||
| 8158 | 9년 전 | 260 | ||
| 8157 | 9년 전 | 386 | ||
| 8156 | 9년 전 | 280 | ||
| 8155 | 9년 전 | 261 | ||
| 8154 |
00년생용띠
|
9년 전 | 605 | |
| 8153 | 9년 전 | 236 | ||
| 8152 |
|
9년 전 | 418 | |
| 8151 | 9년 전 | 413 | ||
| 8150 | 9년 전 | 510 | ||
| 8149 |
Jangfolk
|
9년 전 | 354 | |
| 8148 | 9년 전 | 179 | ||
| 8147 | 9년 전 | 380 | ||
| 8146 | 9년 전 | 448 | ||
| 8145 | 9년 전 | 391 | ||
| 8144 | 9년 전 | 359 | ||
| 8143 | 9년 전 | 203 | ||
| 8142 | 9년 전 | 432 | ||
| 8141 | 9년 전 | 385 | ||
| 8140 | 9년 전 | 933 | ||
| 8139 | 9년 전 | 268 | ||
| 8138 |
전갈자리남자
|
9년 전 | 393 | |
| 8137 | 9년 전 | 402 | ||
| 8136 | 9년 전 | 755 | ||
| 8135 |
|
9년 전 | 802 | |
| 8134 |
PlayPixel
|
9년 전 | 523 | |
| 8133 |
|
9년 전 | 444 | |
| 8132 | 9년 전 | 460 | ||
| 8131 | 9년 전 | 819 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기