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

<script type="text/javascript">

function addTextNode()
{
para.appendChild(document.createTextNode(" Some text added dynamically. "));
}

</script>
</head>

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

<button id="button1" >add another textNode.</button>

<script>
var button = document.getElementById("button1");
var para = document.getElementById("p1");

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

</body>
</html>