带有classList的代码在IE中不起作用?

带有classList的代码在IE中不起作用?,第1张

带有classList的代码在IE中不起作用

classList
IE9及更低版本不支持该属性。IE10
+支持它。
使用
className += " .."
代替。注意:不要忽略空格:类名应添加在以空格分隔的列表中。

var img = new Image();img.src = '/image/file.png';img.title = 'this is a title';img.className += " profilePic"; // Add profilePic class to the imagevar div = document.createElement("div");div.className += " picWindow";  // Add picWindow class to the divdiv.appendChild(img);content.appendChild(div);


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5427482.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-11
下一篇2022-12-11

发表评论

登录后才能评论

评论列表(0条)

    保存