js拼接字符串,动态id

时间:2025-02-07 07:52:38
var str = '';
            str += '<tr style="vertical-align: middle !important;text-align: center;" >';
            str += '<td class="width-5 active"><input type="checkbox" value="1"/></td>';
            str += '<td class="width-15 active"><input type="text" name="fpxm'+hanghao+'" class="form-control required" value=""  οnclick="showDiv('+hanghao+')" AUTOCOMPLETE="off"/><div style="display: none;"><div tabindex="0" οnfοcus="test()" hidefocus="true" οnblur="moveout1('+hanghao+')" style="max-height: 150px;max-width: 150px;font-size:10px;overflow: scroll;position: absolute;border:1px; solid #ccc;outline=0;" ></div></div></td>';
            str += '<td class="width-15 active"><input type="text" name="bxxm'+hanghao+'" class="form-control required" value="" οnchange="getysyeandspr('+hanghao+')" οnclick="showDiv2('+hanghao+')"   AUTOCOMPLETE="off"/><div  tabindex="0"  οnblur="moveout2('+hanghao+')" style="display: none;"><div style="max-height: 150px;max-width: 150px;font-size:10px;overflow: scroll;position: absolute;" ></div></div></td>';
            str += '<td class="width-15 active"><input type="text" name="cdbm'+hanghao+'" class="form-control required" value=""  οnchange="getysyeandspr('+hanghao+')" οnclick="showDiv3('+hanghao+')"  AUTOCOMPLETE="off"/><input type="hidden" name="cdbmid'+hanghao+'" /><div tabindex="0"  οnblur="moveout3('+hanghao+')" style="display: none;"><div style="max-height: 150px;max-width: 150px;font-size:10px;overflow: scroll;position: absolute;" ></div></div></td>';
            str += '<td class="width-15 active"><input type="text" name="xm'+hanghao+'" class="form-control" value="" /><div style="display: none;"><div style="max-height: 100px;overflow: scroll;position: absolute;" ></div></div></td>';
            str += '<td class="width-15 active"><input type="text" style="border-style:none" readonly=readonly  name="ysye'+hanghao+'" value="" class="form-control"/></td>';
            str += '<td class="width-15 active"><input type="text" name="je'+hanghao+'" min="0" class="form-control required"/></td>';
            str += '<td class="width-15 active"><input type="text" name="zy'+hanghao+'" class="form-control required"/></td>';
           
            str += '</tr>';
            $("#fybxtbodyid").append(str);