You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
612 B
33 lines
612 B
<html>
|
|
<head>
|
|
<title>createTextNode onload example</title>
|
|
|
|
<noscript><p>Javascript is disabled</p></noscript>
|
|
<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>
|