var table = document.getElementById(table1);
var lastRow = table.rows.length;
var country = lastRow.getElementById('Country');
country.setAttribute('class', "Country"+lastRow);
Run Code Online (Sandbox Code Playgroud)
我很新,我想知道这是否可能?
代替
var Country= document.getElementById('Country');
Run Code Online (Sandbox Code Playgroud)
因为我有其他id = Country因为我正在添加新行..
编辑
我知道身份证是独特的.但是我克隆了最后一行,所以ID当然都是一样的.
可以从rows属性访问表的最后一行.
var lastRow = table.rows[ table.rows.length - 1 ];
Run Code Online (Sandbox Code Playgroud)
不过,我认为对于你究竟要求的内容存在一些困惑.
| 归档时间: |
|
| 查看次数: |
31406 次 |
| 最近记录: |