불당님이 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 로 ~
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7630 | 10년 전 | 676 | ||
| 7629 |
|
10년 전 | 2436 | |
| 7628 | 10년 전 | 814 | ||
| 7627 |
|
10년 전 | 1051 | |
| 7626 |
|
10년 전 | 1806 | |
| 7625 | 10년 전 | 741 | ||
| 7624 | 10년 전 | 750 | ||
| 7623 |
|
10년 전 | 3136 | |
| 7622 | 10년 전 | 752 | ||
| 7621 |
leeleeleelee
|
10년 전 | 607 | |
| 7620 | 10년 전 | 555 | ||
| 7619 | 10년 전 | 523 | ||
| 7618 | 10년 전 | 1059 | ||
| 7617 | 10년 전 | 740 | ||
| 7616 | 10년 전 | 680 | ||
| 7615 | 10년 전 | 741 | ||
| 7614 | 10년 전 | 1284 | ||
| 7613 |
|
10년 전 | 2100 | |
| 7612 | 10년 전 | 1182 | ||
| 7611 | 10년 전 | 1447 | ||
| 7610 |
|
10년 전 | 1923 | |
| 7609 |
|
10년 전 | 1378 | |
| 7608 |
mwdkim
|
10년 전 | 1153 | |
| 7607 |
|
10년 전 | 1083 | |
| 7606 |
mwdkim
|
10년 전 | 3957 | |
| 7605 | 10년 전 | 707 | ||
| 7604 | 10년 전 | 1044 | ||
| 7603 | 10년 전 | 1664 | ||
| 7602 |
|
10년 전 | 1097 | |
| 7601 |
AniNest
|
10년 전 | 2811 | |
| 7600 |
port443
|
10년 전 | 1055 | |
| 7599 | 10년 전 | 962 | ||
| 7598 | 10년 전 | 1041 | ||
| 7597 | 10년 전 | 4590 | ||
| 7596 |
SeungYeon
|
10년 전 | 911 | |
| 7595 |
untitled
|
10년 전 | 2459 | |
| 7594 |
프로그래머7
|
10년 전 | 1749 | |
| 7593 |
untitled
|
10년 전 | 2392 | |
| 7592 |
untitled
|
10년 전 | 1957 | |
| 7591 |
untitled
|
10년 전 | 2694 | |
| 7590 |
아리마2001
|
10년 전 | 872 | |
| 7589 | 10년 전 | 1124 | ||
| 7588 |
|
10년 전 | 2939 | |
| 7587 | 10년 전 | 1320 | ||
| 7586 | 10년 전 | 687 | ||
| 7585 | 10년 전 | 1724 | ||
| 7584 | 10년 전 | 1424 | ||
| 7583 |
leeleeleelee
|
10년 전 | 1190 | |
| 7582 |
|
10년 전 | 1151 | |
| 7581 | 10년 전 | 1380 | ||
| 7580 | 10년 전 | 1033 | ||
| 7579 |
|
10년 전 | 622 | |
| 7578 | 10년 전 | 1444 | ||
| 7577 |
|
10년 전 | 1890 | |
| 7576 | 10년 전 | 1402 | ||
| 7575 |
멋진남자임
|
10년 전 | 1483 | |
| 7574 | 10년 전 | 2147 | ||
| 7573 | 10년 전 | 3283 | ||
| 7572 | 10년 전 | 779 | ||
| 7571 |
|
10년 전 | 798 | |
| 7570 |
|
10년 전 | 1341 | |
| 7569 | 10년 전 | 1567 | ||
| 7568 |
this1mg
|
10년 전 | 1065 | |
| 7567 |
|
10년 전 | 785 | |
| 7566 | 10년 전 | 930 | ||
| 7565 |
Angel하늘
|
10년 전 | 1034 | |
| 7564 |
seoldi
|
10년 전 | 1279 | |
| 7563 |
|
10년 전 | 1418 | |
| 7562 |
멋진남자임
|
10년 전 | 2118 | |
| 7561 | 10년 전 | 739 | ||
| 7560 |
leeleeleelee
|
10년 전 | 934 | |
| 7559 | 10년 전 | 5072 | ||
| 7558 |
RinaP
|
10년 전 | 812 | |
| 7557 |
|
10년 전 | 1272 | |
| 7556 | 10년 전 | 1213 | ||
| 7555 |
hyohyojj1234
|
10년 전 | 1681 | |
| 7554 | 10년 전 | 1109 | ||
| 7553 |
senseme
|
10년 전 | 1360 | |
| 7552 |
ehdltdoit
|
10년 전 | 1456 | |
| 7551 |
|
10년 전 | 1846 | |
| 7550 |
leeleeleelee
|
10년 전 | 1617 | |
| 7549 | 10년 전 | 2448 | ||
| 7548 | 10년 전 | 1856 | ||
| 7547 |
멋진남자임
|
10년 전 | 1979 | |
| 7546 | 10년 전 | 1022 | ||
| 7545 |
ILMare1003
|
10년 전 | 1315 | |
| 7544 |
|
10년 전 | 1269 | |
| 7543 | 10년 전 | 903 | ||
| 7542 | 10년 전 | 682 | ||
| 7541 |
울라라라우
|
10년 전 | 885 | |
| 7540 | 10년 전 | 1608 | ||
| 7539 | 10년 전 | 958 | ||
| 7538 |
|
10년 전 | 1846 | |
| 7537 | 10년 전 | 3632 | ||
| 7536 |
Gaumi
|
10년 전 | 1443 | |
| 7535 |
프로그램은어려워
|
10년 전 | 1299 | |
| 7534 |
senseme
|
10년 전 | 1219 | |
| 7533 | 10년 전 | 1223 | ||
| 7532 | 10년 전 | 890 | ||
| 7531 | 10년 전 | 2080 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기