불당님이 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 로 ~
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7730 | 10년 전 | 1272 | ||
| 7729 | 10년 전 | 1082 | ||
| 7728 |
잘살아보자
|
10년 전 | 546 | |
| 7727 |
잘살아보자
|
10년 전 | 453 | |
| 7726 |
잘살아보자
|
10년 전 | 791 | |
| 7725 |
잘살아보자
|
10년 전 | 515 | |
| 7724 |
잘살아보자
|
10년 전 | 424 | |
| 7723 |
잘살아보자
|
10년 전 | 490 | |
| 7722 |
잘살아보자
|
10년 전 | 421 | |
| 7721 |
잘살아보자
|
10년 전 | 464 | |
| 7720 |
잘살아보자
|
10년 전 | 406 | |
| 7719 |
비긴어게인
|
10년 전 | 646 | |
| 7718 |
|
10년 전 | 2493 | |
| 7717 |
잘살아보자
|
10년 전 | 627 | |
| 7716 |
잘살아보자
|
10년 전 | 360 | |
| 7715 |
잘살아보자
|
10년 전 | 407 | |
| 7714 |
잘살아보자
|
10년 전 | 435 | |
| 7713 | 10년 전 | 1737 | ||
| 7712 | 10년 전 | 1663 | ||
| 7711 | 10년 전 | 1053 | ||
| 7710 | 10년 전 | 1340 | ||
| 7709 | 10년 전 | 1477 | ||
| 7708 | 10년 전 | 1434 | ||
| 7707 | 10년 전 | 818 | ||
| 7706 |
별지기천사
|
10년 전 | 547 | |
| 7705 | 10년 전 | 1042 | ||
| 7704 |
ICONdesignstudio
|
10년 전 | 585 | |
| 7703 | 10년 전 | 542 | ||
| 7702 |
|
10년 전 | 680 | |
| 7701 | 10년 전 | 1370 | ||
| 7700 | 10년 전 | 1073 | ||
| 7699 | 10년 전 | 557 | ||
| 7698 | 10년 전 | 1106 | ||
| 7697 | 10년 전 | 5112 | ||
| 7696 | 10년 전 | 605 | ||
| 7695 | 10년 전 | 1650 | ||
| 7694 | 10년 전 | 1015 | ||
| 7693 | 10년 전 | 1507 | ||
| 7692 | 10년 전 | 1248 | ||
| 7691 | 10년 전 | 781 | ||
| 7690 | 10년 전 | 1355 | ||
| 7689 | 10년 전 | 977 | ||
| 7688 | 10년 전 | 546 | ||
| 7687 |
파랑새1597
|
10년 전 | 551 | |
| 7686 | 10년 전 | 800 | ||
| 7685 | 10년 전 | 1316 | ||
| 7684 | 10년 전 | 767 | ||
| 7683 | 10년 전 | 1009 | ||
| 7682 | 10년 전 | 879 | ||
| 7681 | 10년 전 | 615 | ||
| 7680 | 10년 전 | 949 | ||
| 7679 | 10년 전 | 451 | ||
| 7678 | 10년 전 | 689 | ||
| 7677 | 10년 전 | 593 | ||
| 7676 |
|
10년 전 | 911 | |
| 7675 |
|
10년 전 | 1110 | |
| 7674 | 10년 전 | 1026 | ||
| 7673 | 10년 전 | 721 | ||
| 7672 | 10년 전 | 1049 | ||
| 7671 | 10년 전 | 835 | ||
| 7670 | 10년 전 | 595 | ||
| 7669 |
mashmellow
|
10년 전 | 1198 | |
| 7668 | 10년 전 | 673 | ||
| 7667 | 10년 전 | 950 | ||
| 7666 |
senseme
|
10년 전 | 620 | |
| 7665 | 10년 전 | 473 | ||
| 7664 | 10년 전 | 1859 | ||
| 7663 |
mixx애교
|
10년 전 | 952 | |
| 7662 | 10년 전 | 979 | ||
| 7661 |
hkhkah
|
10년 전 | 750 | |
| 7660 | 10년 전 | 1037 | ||
| 7659 |
커네드커네드
|
10년 전 | 901 | |
| 7658 |
바람돌이팡
|
10년 전 | 630 | |
| 7657 | 10년 전 | 1120 | ||
| 7656 | 10년 전 | 1542 | ||
| 7655 | 10년 전 | 948 | ||
| 7654 |
개발짜증나
|
10년 전 | 827 | |
| 7653 |
네이비칼라
|
10년 전 | 858 | |
| 7652 |
밥먹고합시다
|
10년 전 | 781 | |
| 7651 |
플라이SINJI
|
10년 전 | 1481 | |
| 7650 |
개발짜증나
|
10년 전 | 1375 | |
| 7649 | 10년 전 | 430 | ||
| 7648 |
이미영ㅇㅇ
|
10년 전 | 819 | |
| 7647 | 10년 전 | 407 | ||
| 7646 | 10년 전 | 769 | ||
| 7645 | 10년 전 | 2258 | ||
| 7644 | 10년 전 | 791 | ||
| 7643 |
|
10년 전 | 2831 | |
| 7642 | 10년 전 | 1482 | ||
| 7641 | 10년 전 | 1106 | ||
| 7640 |
개발짜증나
|
10년 전 | 447 | |
| 7639 |
|
10년 전 | 785 | |
| 7638 |
개발짜증나
|
10년 전 | 1090 | |
| 7637 | 10년 전 | 1508 | ||
| 7636 | 10년 전 | 2875 | ||
| 7635 | 10년 전 | 1654 | ||
| 7634 | 10년 전 | 1819 | ||
| 7633 | 10년 전 | 2286 | ||
| 7632 | 10년 전 | 3881 | ||
| 7631 |
|
10년 전 | 1498 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기