summaryrefslogtreecommitdiff
path: root/test/js/event-onload.html
blob: aede985a421167a46bc9d8267ed5100c3777b6ba (plain)
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
<html>
<head>
<title>createTextNode onload example</title>

<script type="text/javascript">

function addTextNode()
{
var newtext = document.createTextNode(" Some text added dynamically. ");
var para = document.getElementById("p1");
para.appendChild(newtext);
}

</script>
</head>

<body>
<div style="border: 1px solid red">
<p id="p1">First line of paragraph.<br /></p>
</div><br />

<button onclick="addTextNode();">add another textNode.</button>

<script>
window.onload = addTextNode;
</script>

</body>
</html>