Simple example of adding and removing HTML nodes

Time:2022-3-31

Simple example of adding and removing HTML nodes
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>

Recommended Today

Fourth, handwritten SpringMVC framework, business layer – what is coupling/dependency? How to solve

4. Business Layer 4.1 MVC model MVC:Model(Model),View(view),Controller(controller) View layer: an interface for displaying data and interacting with users=>jsp Control layer: It can accept the client's request and forward the request. The specific business function still needs to be completed with the help of the model layer component. CoreServlet  => DispacherServlet + EmpController Model layer: There are […]