//HTML代码 <table id="templateTable" > <tr> <td id="oneTd" > <div class="control-group"> <label class="control-label required"> <span class="help-inline"><font color="red">*</font> </span>房间类型: </label> <div class="controls"> <input type="text" name="roomType" id="roomType1" required="required" onblur="quchong(1)"/> </div> </div> </tr> </table>
//js <script> function addTr() { m = templateTable.rows[0].cells.length n = m + 1; var trHtml = $("#templateTable1 tr :first").html(); trHtml = trHtml.replace(id="roomType1",id="roomType"+n); trHtml = trHtml.replace(onblur="quchong(1)",onblur="quchong"+"("+n+")"); $("#templateTable tr").append(trHtml); } </script>
时间: 2024-11-04 03:37:05