<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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 330 |
prosper
|
20년 전 | 2250 | |
| 329 |
prosper
|
20년 전 | 1863 | |
| 328 |
prosper
|
20년 전 | 1674 | |
| 327 | 20년 전 | 3751 | ||
| 326 | 20년 전 | 4832 | ||
| 325 |
hwatta
|
20년 전 | 2460 | |
| 324 |
|
20년 전 | 3128 | |
| 323 | 20년 전 | 5839 | ||
| 322 |
hwatta
|
20년 전 | 2825 | |
| 321 |
hwatta
|
20년 전 | 2302 | |
| 320 |
yesmoa
|
20년 전 | 4560 | |
| 319 | 20년 전 | 2664 | ||
| 318 | 20년 전 | 2229 | ||
| 317 |
kyodon
|
20년 전 | 2755 | |
| 316 | 20년 전 | 2562 | ||
| 315 |
|
20년 전 | 2870 | |
| 314 |
|
20년 전 | 3322 | |
| 313 |
|
20년 전 | 2629 | |
| 312 |
yesmoa
|
20년 전 | 4702 | |
| 311 | 20년 전 | 3255 | ||
| 310 |
홀로남은자
|
20년 전 | 4545 | |
| 309 | 20년 전 | 3001 | ||
| 308 | 20년 전 | 4114 | ||
| 307 | 20년 전 | 4346 | ||
| 306 | 20년 전 | 7020 | ||
| 305 | 20년 전 | 3859 | ||
| 304 | 20년 전 | 2750 | ||
| 303 |
크리스탈처럼
|
20년 전 | 4384 | |
| 302 | 20년 전 | 2196 | ||
| 301 |
|
20년 전 | 4313 | |
| 300 | 20년 전 | 3782 | ||
| 299 | 20년 전 | 2588 | ||
| 298 | 20년 전 | 4814 | ||
| 297 |
|
20년 전 | 2517 | |
| 296 | 20년 전 | 4512 | ||
| 295 | 20년 전 | 3557 | ||
| 294 | 20년 전 | 3584 | ||
| 293 | 20년 전 | 3807 | ||
| 292 | 20년 전 | 3196 | ||
| 291 |
yesmoa
|
20년 전 | 5924 | |
| 290 | 20년 전 | 2931 | ||
| 289 | 20년 전 | 5833 | ||
| 288 |
|
20년 전 | 2364 | |
| 287 |
|
20년 전 | 1778 | |
| 286 |
|
20년 전 | 2135 | |
| 285 |
|
20년 전 | 3529 | |
| 284 |
|
20년 전 | 2026 | |
| 283 |
|
20년 전 | 4397 | |
| 282 | 20년 전 | 3378 | ||
| 281 |
|
20년 전 | 2197 | |
| 280 |
|
20년 전 | 7792 | |
| 279 | 20년 전 | 5535 | ||
| 278 | 20년 전 | 2981 | ||
| 277 |
|
20년 전 | 5562 | |
| 276 | 20년 전 | 2350 | ||
| 275 | 20년 전 | 2594 | ||
| 274 | 20년 전 | 2367 | ||
| 273 | 20년 전 | 2206 | ||
| 272 | 20년 전 | 2135 | ||
| 271 | 20년 전 | 2594 | ||
| 270 | 20년 전 | 2606 | ||
| 269 | 20년 전 | 2473 | ||
| 268 | 20년 전 | 2669 | ||
| 267 | 20년 전 | 2353 | ||
| 266 | 20년 전 | 2557 | ||
| 265 | 20년 전 | 3491 | ||
| 264 |
|
20년 전 | 5347 | |
| 263 |
|
20년 전 | 3714 | |
| 262 | 20년 전 | 3165 | ||
| 261 |
허저비
|
20년 전 | 5914 | |
| 260 |
|
20년 전 | 5707 | |
| 259 | 20년 전 | 4129 | ||
| 258 | 20년 전 | 2372 | ||
| 257 | 20년 전 | 3176 | ||
| 256 | 20년 전 | 1893 | ||
| 255 | 20년 전 | 1559 | ||
| 254 | 20년 전 | 3132 | ||
| 253 | 20년 전 | 3539 | ||
| 252 | 20년 전 | 5111 | ||
| 251 | 20년 전 | 5795 | ||
| 250 | 20년 전 | 3667 | ||
| 249 | 20년 전 | 5010 | ||
| 248 | 20년 전 | 3273 | ||
| 247 | 20년 전 | 3627 | ||
| 246 |
|
20년 전 | 7940 | |
| 245 |
|
20년 전 | 5894 | |
| 244 | 20년 전 | 4475 | ||
| 243 |
|
20년 전 | 4041 | |
| 242 | 20년 전 | 2770 | ||
| 241 | 20년 전 | 2710 | ||
| 240 | 20년 전 | 2351 | ||
| 239 | 20년 전 | 1648 | ||
| 238 |
아우겐나이스
|
20년 전 | 2254 | |
| 237 |
email
|
20년 전 | 3676 | |
| 236 | 20년 전 | 4142 | ||
| 235 | 20년 전 | 10457 | ||
| 234 | 20년 전 | 5056 | ||
| 233 | 20년 전 | 3360 | ||
| 232 | 20년 전 | 3192 | ||
| 231 | 20년 전 | 3829 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기