document.writeln引入js文件的bug
以下代码重现该bug
?
1,a.html
?
document.write('<script src="b.js"></script>');document.write('<DIV id="d1"></DIV>')alert(document.getElementById('d1'));
?
3,b.js中内容随意,甚至可以什么都不写,只要新建该文件即可
?
?
打开html后,只在IE中能弹出div[id=d1],其它浏览器都是null。即元素div[id=d1]在IE中能获取到,其它浏览器不能获取到。这需要注意!
?
?
?
?
?
?
1 楼 xylzh46 2011-08-26 有解决办法吗?