setAttribute 设置 className、colspan

作者:vkvi 来源:ITPOW(原创) 日期:2009-8-7

IE 的 setAttribute 在针对某些属性(比如事件、集合)时是不起作用的。

td.className = "name"; // IE、Firefox 中均有效
td.setAttribute("className", "name"); // IE 中有效
td.setAttribute("class", "name"); // Firefox 中有效

同理:

td.colSpan = 3; // IE、Firefox 中均有效
td.setAttribute("colSpan", 3); // IE 中有效
td.setAttribute("colspan", 3); // Firefox 中有效

相关阅读

相关文章