ie中js创建checkbox默认选中问题

xiaoxiao2021-03-01  15

测试浏览器:ie8(兼容和不兼容模式),ff6。

var chk = document.createElement("input");

chk.setAttribute("type","checkbox");

container.appendChild(chk);

chk.setAttribute("checked",true);

以上代码在ie8兼容模式和ff6下都没有总是,但在ie8不兼容模式下不起作用,只有在appendChild后,再设置checked的值就都起作用,如下:

var chk = document.createElement("input");

chk.setAttribute("type","checkbox");

chk.setAttribute("checked",true);

container.appendChild(chk);

P.S. 不知道微软在搞什么:(

相关资源:Office2016专业增强版中文免费正式版(附安装教程)64位
转载请注明原文地址: https://www.6miu.com/read-4050081.html

最新回复(0)