查看: 264|回复: 2
|
How to change childNodes in JavaScript?
[复制链接]
|
|
要如何 clone the table 然后自动增加这 #changeThis 数字当我按这 button?
我的问题如下,
<button type="button" onclick="cloneTable()">clone Table</button>
<table>
<tr>
<th id="changeThis">1</th>
<td>
<select name="" size="1">
<option></option>
<option></option>
<option></option>
</select>
<input type="text" >
</td>
</tr>
</table> |
|
|
|
|
|
|
|
发表于 21-2-2017 05:48 PM
|
显示全部楼层
方法一开始就错了..应该是有一个var tableCount = 1 用来算你现在有几个table然后用cloneTable(tableCount)把tableCount放进去就可以在function里面用<th id="changeThis">tableCount</th>来增加..完成后记得tableCount++ |
|
|
|
|
|
|
|
楼主 |
发表于 21-2-2017 09:00 PM
|
显示全部楼层
qwqwqwqw 发表于 21-2-2017 05:48 PM
方法一开始就错了..应该是有一个var tableCount = 1 用来算你现在有几个table然后用cloneTable(tableCount)把tableCount放进去就可以在function里面用tableCount来增加..完成后记得tableCount++
谢谢
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|