Simple example of adding and removing HTML nodes

Simple example of adding and removing HTML nodes
<br />Simple example of adding and removing HTML nodes
<input type="button" onclick="appendnode()" value="Add node">
<input type="button" onclick="removenode()" value="Delete node">
<div id="result"></div>
<script>
i=0
function appendnode() {
o=document.createElement("DIV");
o.innerHTML="test" i
document.getElementById('result').appendChild(o);
i
}
function removenode(){
var x = document.getElementById('result');
x.removeChild(x.lastChild) //Delete from the last node
}
</script>

<<:  Share CSS writing standards and order [recommended for everyone to use]

>>:  Example of how to configure nginx to implement SSL

Recommend

MySQL 8.0.22 installation and configuration graphic tutorial

MySQL8.0.22 installation and configuration (super...

Detailed explanation of HTML form elements (Part 2)

HTML Input Attributes The value attribute The val...

Detailed tutorial on installing Python 3 virtual environment in Ubuntu 20.04

The following are all performed on my virtual mac...

Native JS to achieve digital table special effects

This article shares a digital clock effect implem...

Linux platform mysql enable remote login

During the development process, I often encounter...

Vue implements verification code countdown button

This article example shares the specific code of ...

The difference between absolute path and relative path in web page creation

1. Absolute path First of all, on the local compu...

IE8 Beta 1 has two areas that require your attention

<br />Related articles: Web skills: Multiple...

Several common methods for passing additional parameters when submitting a form

When submitting a form, you may encounter situatio...

Sample code for a simple seamless scrolling carousel implemented with native Js

There are many loopholes in the simple seamless s...

Linux ssh server configuration code example

Use the following terminal command to install the...