IE下测试有4个节点,Chrome下有7个
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>无标题文档</title> </head> <body> <div> javascript <p>javascript</p> <div>jQuery</div> <h5>PHP</h5> </div> <script type="text/javascript"> var node = document.getElementsByTagName("div")[0].childNodes; document.write("共有"+ node.length +"个节点:(名称/节点值/节点类型)<br/><br/>"); for (var i=0; i<node.length; i++){ document.write("【" + (i+1) + "】<br/>" + node[i].nodeName +" "+ node[i].nodeValue +" "+ node[i].nodeType + "<br/><br/>"); } </script> </body> </html>
在IE下测试有4个节点,在Chrome下有7个,这对于开发有哪些不利(不便之处)?