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

WBOY
Release: 2016-05-16 16:44:17
Original
1266 people have browsed it

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>
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template