netsurf/test/js/event-onload.html

33 lines
612 B
HTML
Raw Normal View History

2012-11-19 21:26:23 +04:00
<html>
<head>
<title>createTextNode onload example</title>
<noscript><p>Javascript is disabled</p></noscript>
2012-11-19 21:26:23 +04:00
<script type="text/javascript">
function addTextNode()
{
2012-12-03 21:09:44 +04:00
para.appendChild(document.createTextNode(" Some text added dynamically. "));
2012-11-19 21:26:23 +04:00
}
</script>
</head>
<body>
<div style="border: 1px solid red">
<p id="p1">First line of paragraph.<br /></p>
</div><br />
2012-12-03 21:09:44 +04:00
<button id="button1" >add another textNode.</button>
2012-11-19 21:26:23 +04:00
<script>
2012-12-03 21:09:44 +04:00
var button = document.getElementById("button1");
var para = document.getElementById("p1");
2012-11-19 21:26:23 +04:00
window.onload = addTextNode;
2012-12-03 21:09:44 +04:00
button.onclick = addTextNode;
2012-11-19 21:26:23 +04:00
</script>
</body>
</html>