불당님이 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 로 ~
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 378 | ||
| 7929 | 9년 전 | 268 | ||
| 7928 | 9년 전 | 379 | ||
| 7927 | 9년 전 | 300 | ||
| 7926 | 9년 전 | 648 | ||
| 7925 | 9년 전 | 319 | ||
| 7924 | 9년 전 | 293 | ||
| 7923 | 9년 전 | 323 | ||
| 7922 | 9년 전 | 348 | ||
| 7921 | 9년 전 | 378 | ||
| 7920 | 9년 전 | 301 | ||
| 7919 | 9년 전 | 314 | ||
| 7918 | 9년 전 | 477 | ||
| 7917 | 9년 전 | 319 | ||
| 7916 | 9년 전 | 386 | ||
| 7915 | 9년 전 | 372 | ||
| 7914 | 9년 전 | 385 | ||
| 7913 | 9년 전 | 510 | ||
| 7912 | 9년 전 | 386 | ||
| 7911 | 9년 전 | 334 | ||
| 7910 | 9년 전 | 370 | ||
| 7909 | 9년 전 | 473 | ||
| 7908 | 9년 전 | 373 | ||
| 7907 | 9년 전 | 326 | ||
| 7906 | 9년 전 | 342 | ||
| 7905 | 9년 전 | 332 | ||
| 7904 | 9년 전 | 303 | ||
| 7903 | 9년 전 | 306 | ||
| 7902 | 9년 전 | 521 | ||
| 7901 |
|
9년 전 | 719 | |
| 7900 | 9년 전 | 545 | ||
| 7899 | 9년 전 | 352 | ||
| 7898 | 9년 전 | 343 | ||
| 7897 | 9년 전 | 301 | ||
| 7896 | 9년 전 | 328 | ||
| 7895 | 9년 전 | 430 | ||
| 7894 | 9년 전 | 353 | ||
| 7893 | 9년 전 | 289 | ||
| 7892 | 9년 전 | 334 | ||
| 7891 | 9년 전 | 723 | ||
| 7890 | 9년 전 | 1178 | ||
| 7889 | 9년 전 | 735 | ||
| 7888 |
limsy1987
|
9년 전 | 531 | |
| 7887 | 9년 전 | 509 | ||
| 7886 | 9년 전 | 398 | ||
| 7885 | 9년 전 | 369 | ||
| 7884 | 9년 전 | 378 | ||
| 7883 | 9년 전 | 365 | ||
| 7882 | 9년 전 | 381 | ||
| 7881 | 9년 전 | 404 | ||
| 7880 | 9년 전 | 528 | ||
| 7879 | 9년 전 | 426 | ||
| 7878 | 9년 전 | 1166 | ||
| 7877 | 9년 전 | 715 | ||
| 7876 | 9년 전 | 444 | ||
| 7875 | 9년 전 | 516 | ||
| 7874 |
|
9년 전 | 785 | |
| 7873 | 9년 전 | 485 | ||
| 7872 | 9년 전 | 623 | ||
| 7871 | 9년 전 | 451 | ||
| 7870 | 9년 전 | 576 | ||
| 7869 | 9년 전 | 395 | ||
| 7868 | 9년 전 | 389 | ||
| 7867 | 9년 전 | 387 | ||
| 7866 | 9년 전 | 446 | ||
| 7865 | 9년 전 | 407 | ||
| 7864 | 9년 전 | 472 | ||
| 7863 | 9년 전 | 461 | ||
| 7862 | 9년 전 | 440 | ||
| 7861 | 9년 전 | 598 | ||
| 7860 | 9년 전 | 595 | ||
| 7859 | 9년 전 | 374 | ||
| 7858 | 9년 전 | 675 | ||
| 7857 | 9년 전 | 1029 | ||
| 7856 | 9년 전 | 491 | ||
| 7855 | 9년 전 | 707 | ||
| 7854 | 9년 전 | 702 | ||
| 7853 | 9년 전 | 548 | ||
| 7852 | 9년 전 | 475 | ||
| 7851 | 9년 전 | 454 | ||
| 7850 | 9년 전 | 553 | ||
| 7849 | 9년 전 | 321 | ||
| 7848 | 9년 전 | 374 | ||
| 7847 | 9년 전 | 595 | ||
| 7846 | 9년 전 | 413 | ||
| 7845 | 9년 전 | 375 | ||
| 7844 | 9년 전 | 370 | ||
| 7843 | 9년 전 | 382 | ||
| 7842 | 9년 전 | 372 | ||
| 7841 | 9년 전 | 358 | ||
| 7840 | 9년 전 | 367 | ||
| 7839 | 9년 전 | 402 | ||
| 7838 | 9년 전 | 483 | ||
| 7837 | 9년 전 | 325 | ||
| 7836 | 9년 전 | 365 | ||
| 7835 | 9년 전 | 445 | ||
| 7834 |
|
9년 전 | 1174 | |
| 7833 | 9년 전 | 383 | ||
| 7832 | 9년 전 | 382 | ||
| 7831 | 9년 전 | 515 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기