<body><div id="content"> <h1>html</h1> <h1>php</h1> <h1>javascript</h1> <h1>jquery</h1> <h1>java</h1></div><script type="text/javascript">var content=document.getElementById("content");var hh1=document.getElementsByTagName("h1");//var zijiedian=content.childNodes; function clearText() { for(i=0;i<hh1.length;i++){ content.removeChild(hh1[i]); } // 在此完成该函数 }</script><button onclick="clearText()">清除节点内容</button>
添加回答
举报
0/150
提交
取消