<body> <ul id='ul'> <li>1</li> <li>1</li> <li>1</li> </ul> <script> function clearText(){ var UL = document.getElementById('ul'); var li1 = UL.firstChild; document.write(UL.childNodes.length); UL.removeChild(UL.firstChild); document.write(UL.childNodes.length); } </script> <button onclick="clearText()">清除节点内容</button> </body>当点击按钮是说没有权限
添加回答
举报
0/150
提交
取消