불당님이 jQuery 하시길래 몇일 살펴보았는데 상당히 만족스럽네요.
처음 만들어보는거라 코드가 지저분합니다.
jQuery 잘 아시는 분들은 수정 후 좀 알려주십시오.
<input type=button value='행추가' id='add-row'>
<input type=button value='열추가' id='add-col'>
<input type=button value='행삭제' id='del-row'>
<input type=button value='열삭제' id='del-col'>
<table id='stock_table' border=0>
<thead id='stock_thead'>
<tr>
<td>
<input type=text name=it_opty_subj size=4 class=ed value='<?=$it[it_opty_subj]?>'>
<input type=text name=it_optx_subj size=4 class=ed value='<?=$it[it_optx_subj]?>'>
</td>
<td>
<input type=text name='optx_subj[0]' size=5 class=ed>
</td>
</tr>
</thead>
<tbody id='stock_tbody'>
<tr>
<td><input type=text name='opty_subj[0]' size=10 class=ed></td>
<td><input type=text name='opt[0][0]' size=5 class=ed></td>
</tr>
</tbody>
</table>
... 중략 ...
<script>
var stock_x = 0;
var stock_y = 0;
$(document).ready(function() {
// 행추가
$('#add-row').click(function() {
stock_y++;
var s = "<tr>";
s += "<td><input type=text name='opty_subj["+stock_y+"]' size=10 class=ed></td>"; // 행 제목 추가
var len = $('#stock_thead td').length; // 열의 갯수에 따라 추가된 행의 열 추가
for (i=0; i<len-1; i++) {
s += "<td><input type=text name='opt["+stock_y+"]["+i+"]' size=5 class=ed></td>";
}
s += "</tr>";
$('#stock_tbody').append(s);
});
// 열추가
$('#add-col').click(function() {
stock_x++;
$('#stock_thead tr').append("<td><input type=text name='optx_subj["+stock_x+"]' size=5 class=ed></td>");
$('#stock_tbody tr').each(function(index) {
$(this).append("<td><input type=text name='opt["+index+"]["+stock_x+"]' size=5 class=ed></td>");
});
});
// 행삭제
$('#del-row').click(function() {
if (stock_y > 0) {
$('#stock_tbody tr:last').remove();
stock_y--;
}
});
// 열삭제
$('#del-col').click(function() {
if (stock_x > 0) {
$('#stock_thead td:last').remove();
$('#stock_tbody tr').each(function(index) {
$('td:last', this).remove();
});
stock_x--;
}
});
});
</script>
댓글 4개
<script language="JavaScript" src="<?="$g4[path]/js/board.js"?>"></script>
<script language="JavaScript">
window.onload=function() {
resizeBoardImage(<?=(int)$board[bo_image_width]?>);
drawFont();
}
</script>
차후에는 전부 jQuery 로 ~
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4093 | ||
| 429 | 19년 전 | 3289 | ||
| 428 | 19년 전 | 4125 | ||
| 427 | 19년 전 | 3465 | ||
| 426 | 19년 전 | 3099 | ||
| 425 | 19년 전 | 3393 | ||
| 424 | 19년 전 | 2434 | ||
| 423 | 19년 전 | 2854 | ||
| 422 | 19년 전 | 2343 | ||
| 421 | 19년 전 | 3703 | ||
| 420 | 19년 전 | 4728 | ||
| 419 | 19년 전 | 3783 | ||
| 418 |
|
19년 전 | 1735 | |
| 417 | 19년 전 | 2740 | ||
| 416 | 19년 전 | 2386 | ||
| 415 | 19년 전 | 2601 | ||
| 414 | 19년 전 | 4401 | ||
| 413 |
|
19년 전 | 2585 | |
| 412 | 19년 전 | 3036 | ||
| 411 |
|
19년 전 | 2983 | |
| 410 |
|
19년 전 | 3671 | |
| 409 |
|
19년 전 | 3626 | |
| 408 |
|
19년 전 | 1848 | |
| 407 | 19년 전 | 2222 | ||
| 406 | 19년 전 | 2774 | ||
| 405 | 19년 전 | 2438 | ||
| 404 | 19년 전 | 4292 | ||
| 403 | 19년 전 | 3298 | ||
| 402 |
NeoGenesis
|
19년 전 | 4085 | |
| 401 | 19년 전 | 2600 | ||
| 400 |
|
19년 전 | 2486 | |
| 399 | 19년 전 | 2948 | ||
| 398 | 19년 전 | 2479 | ||
| 397 | 19년 전 | 2776 | ||
| 396 | 19년 전 | 2465 | ||
| 395 | 19년 전 | 3173 | ||
| 394 | 19년 전 | 1707 | ||
| 393 | 19년 전 | 2985 | ||
| 392 | 19년 전 | 2243 | ||
| 391 | 19년 전 | 2174 | ||
| 390 | 19년 전 | 2276 | ||
| 389 | 19년 전 | 2640 | ||
| 388 | 19년 전 | 2145 | ||
| 387 | 19년 전 | 4477 | ||
| 386 |
|
19년 전 | 2678 | |
| 385 |
|
19년 전 | 2471 | |
| 384 | 19년 전 | 2998 | ||
| 383 | 19년 전 | 3042 | ||
| 382 | 19년 전 | 3097 | ||
| 381 |
|
19년 전 | 2627 | |
| 380 |
|
19년 전 | 3009 | |
| 379 | 19년 전 | 2542 | ||
| 378 | 19년 전 | 2201 | ||
| 377 | 19년 전 | 2774 | ||
| 376 | 19년 전 | 2465 | ||
| 375 |
|
19년 전 | 2552 | |
| 374 | 19년 전 | 3804 | ||
| 373 | 19년 전 | 3260 | ||
| 372 | 19년 전 | 4981 | ||
| 371 |
세은아빠2
|
19년 전 | 2407 | |
| 370 | 19년 전 | 4495 | ||
| 369 | 19년 전 | 3104 | ||
| 368 | 19년 전 | 2886 | ||
| 367 | 19년 전 | 3721 | ||
| 366 | 19년 전 | 2635 | ||
| 365 | 19년 전 | 3727 | ||
| 364 | 19년 전 | 4004 | ||
| 363 | 19년 전 | 3428 | ||
| 362 | 19년 전 | 3470 | ||
| 361 | 19년 전 | 4097 | ||
| 360 |
hwatta
|
19년 전 | 2354 | |
| 359 | 19년 전 | 5095 | ||
| 358 | 19년 전 | 3649 | ||
| 357 | 19년 전 | 2588 | ||
| 356 |
sdesign1s
|
19년 전 | 2270 | |
| 355 | 20년 전 | 2738 | ||
| 354 | 20년 전 | 3020 | ||
| 353 | 20년 전 | 2785 | ||
| 352 |
|
20년 전 | 5765 | |
| 351 |
|
20년 전 | 2697 | |
| 350 |
|
20년 전 | 4281 | |
| 349 |
hwatta
|
20년 전 | 2174 | |
| 348 | 20년 전 | 7303 | ||
| 347 | 20년 전 | 2407 | ||
| 346 | 20년 전 | 3493 | ||
| 345 | 20년 전 | 4298 | ||
| 344 | 20년 전 | 2629 | ||
| 343 | 20년 전 | 3913 | ||
| 342 | 20년 전 | 3061 | ||
| 341 | 20년 전 | 4081 | ||
| 340 |
|
20년 전 | 5122 | |
| 339 |
|
20년 전 | 4225 | |
| 338 | 20년 전 | 5858 | ||
| 337 | 20년 전 | 2032 | ||
| 336 |
|
20년 전 | 3304 | |
| 335 |
|
20년 전 | 3530 | |
| 334 |
|
20년 전 | 2913 | |
| 333 |
hwatta
|
20년 전 | 2424 | |
| 332 | 20년 전 | 4647 | ||
| 331 | 20년 전 | 2262 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기