Home >Web Front-end >HTML Tutorial >Simple example of adding and deleting HTML nodes_HTML/Xhtml_Web page production

Simple example of adding and deleting HTML nodes_HTML/Xhtml_Web page production

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:44:171299browse

Simple example of adding and removing HTML nodes



<script><br />i=0<br />function appendnode() {<br />o=document.createElement("DIV");<br />o.innerHTML="test" i<br />document.getElementById('result').appendChild(o);<br />i <br />}<br />function removenode(){<br />var x = document.getElementById('result');<br />x.removeChild(x.lastChild) //从最后个节点删除<br />}<br /></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn