<body><div id="content">? <h1>html</h1>? <h1>php</h1>? <h1>javascript</h1>? <h1>jquery</h1>? <h1>java</h1></div><script type="text/javascript">function clearText() {? var content=document.getElementById("content");? for(i=0;i<content.length;i++)? {content.removeChild(content[i]);? }}</script><button onclick="clearText()">清除節(jié)點(diǎn)內(nèi)容</button>
為什么這樣寫不可以清除子節(jié)點(diǎn)的內(nèi)容?
mk_落葉_363253147
2016-06-07 23:44:37