以下代码重现该bug
1,a.html
<!DOCTYPE html>
<html>
<head></head>
<body>
<script src="a.js"></script>
</body>
</html>
2,a.js
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中能获取到,其它浏览器不能获取到。这需要注意!