用chrome运行 下面html 但是运行但childNodes.* 的时候就报错,难道不支持这个写法了<!DOCTYPE html><html><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>DOM</title></head><body> <div> <h1>sdf</h1> <h2>ser</h2> </div> <script> var someNode = document.getElementsByTagName('div'); console.log(someNode); console.log(someNode.childNodes.length); console.log(someNode.childNode[0]); console.log(someNode.childNode.item(1)); </script> </body></html>
添加回答
举报
0/150
提交
取消