본문 바로가기
Programming Language/Javascript

td add

by 뒹굴거리는프로도 2018. 2. 26.
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var count1 = 0;
var count2 = 0;
var count3 = 0;
 
 
 
function addTd(tableId){
 
    tableId = tableId;
 
    if(tableId == "spa-light-tb"){
        $("<tr id='spa_tr_"+count1+"' >").appendTo($("#spa-light-tb"))
        .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>")
        .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count1+"].lght_cnt' maxlength='25' placeholder='수량을 입력하세요' title=''></td>")
        .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count1+"].sot_knd_code' maxlength='25' placeholder='광원을 입력하세요' title=''></td>")
        .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count1+"].cnsmp_pwrer' maxlength='25' placeholder='소비전력[W]을 입력하세요' title=''></td>")
        .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>")
        .append("<input type='hidden' name='OtdpotDetailVOList["+count1+"].lght_no' value='"+$("#lght_no").val()+"'>")
        .append("</tr>");
 
        count1++;
 
    }else if(tableId== "adv-light-tb"){
        $("<tr id='adv_tr_"+count2+"' >").appendTo($("#adv-light-tb"))
        .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count2+"].sot_knd_code' maxlength='25' placeholder='광원종류를 입력하세요' title=''></td>")
        .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count2+"].lght_color' maxlength='25' placeholder='광원색상을 입력하세요' title=''></td>")
        .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>")
        .append("<input type='hidden' name='OtdpotDetailVOList["+count2+"].lght_no' value='"+$("#lght_no").val()+"'>")
        .append("</tr>");
 
        count2++;
 
    }else if(tableId == "deco-light-tb"){
        $("<tr id='deco_tr_"+count3+"' >").appendTo($("#deco-light-tb"))
        .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count3+"].sot_knd_code' maxlength='25' placeholder='광원종류를 입력하세요' title=''></td>")
        .append("<td><input class='form-control input-sm' name='OtdpotDetailVOList["+count3+"].lght_color' maxlength='25' placeholder='광원색상을 입력하세요' title=''></td>")
        .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>")
        .append("<td><select class='form-control input-sm' name='' id='' title=''><option value=''>선택</option></select></td>")
        .append("<input type='hidden' name='OtdpotDetailVOList["+count3+"].lght_no' value='"+$("#lght_no").val()+"'>")
        .append("</tr>");
 
        count3++;
 
    }
 
 
 
 
}//end addId
 
function remTd(tableId){
 
    if(tableId == "spa-light-tb"){
        count1--;
        $("#spa_tr_"+count1+"").remove();
 
    }else if(tableId == "adv-light-tb"){
        count2--;
        $("#adv_tr_"+count2+"").remove();
 
    }else if(tableId == "deco-light-tb"){
        count3--;
        $("#deco_tr_"+count2+"").remove();
 
    }
 
 
 
 
}//end subTd
 
cs


반응형