How to change page contents dynamically using JavaScript
Posted: Sun Feb 28, 2010 10:47 pm
Say we have following simple text:
In Internet Explorer 4 or above, the script to change the above text is:
In Netscape 6 (works in IE6 as well), the idea to alter a text is very similar, except in the precise syntax:
In Netscape 4:
First we need to set the required tags as follows.
Then the code is as below:
Code: Select all
<div ID="testing">ROBOT.LK</div>
Code: Select all
document.all.testing.innerHTML = "A very nice site!"
Code: Select all
document.getElementById("testing").innerHTML = "A very nice site!"
First we need to set the required tags as follows.
Code: Select all
<ilayer name="testing"><layer name="testing2">ROBOT.LK</layer></ilayer>
Code: Select all
document.testing.document.test2.document.write("A very nice site!")
document.testing.document.test2.document.close()