-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOM3.html
More file actions
50 lines (49 loc) · 1.24 KB
/
DOM3.html
File metadata and controls
50 lines (49 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<head>
<title>DOM3</title>
<script>
function myfunc1()
{
var list=document.createElement("li");
var node=document.createTextNode("DBMS");
list.appendChild(node);
var element=document.getElementById("ul1");
element.appendChild(list);
}
function myfunc2()
{
var list=document.createElement("li");
var node=document.createTextNode("network");
list.appendChild(node);
var element=document.getElementById("ul1");
var child=document.getElementById("c");
element.insertBefore(list,child);
}
function myfunc3()
{
var element=document.getElementById("ul1");
var child=document.getElementById("b");
element.removeChild(child);
}
function myfunc4()
{
var list=document.createElement("li");
var node=document.createTextNode("msg");
list.appendChild(node);
var element=document.getElementById("ul1");
var child=document.getElementById("c");
element.replaceChild(list,child);
}
</script>
</head>
<body>
<ul id="ul1">
<li id="a">C++</li>
<li id="b">java</li>
<li id="c">web</li>
</ul>
<input type="button" value="create" onclick="myfunc1()">
<input type="button" value="insert" onclick="myfunc2()">
<input type="button" value="remove" onclick="myfunc3()">
<input type="button" value="replace" onclick="myfunc4()">
</body>