这是我的代码,我想得到childNodes并循环创建这些标签,但在IE8中打印2
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="div"></div>
<script type="text/javascript">
var div = document.getElementById('div');
var code = '<script>alert("hello");<\/script><div>dsd<\/div><script>alert("hi");<\/script>';
div.innerHTML = code;
console.log(div.children.length);
console.log(div.childNodes.length)
</script>
</body>
</html>