Enter some text in the box below and click on the button "Modify Text".
This text changes
Originally, the above paragraph says, "This text changes", but after entering
"Hello" in the box and clicking the button, the text becomes the same as the
text in the box above (in this case "Hello"). Try entering different text,
including none at all and see what happens.
Here is the code for this function:
//we get the paragraph object using "getElementById"
//using the ID of the paragraph
var para =
//we then set the value of the lastChild.nodeValue to the
// text input box value.
Many years ago, when I wrote the document.write
a way to change text in a page after it had loaded, and for the code to work in the main
browsers. Now we have such code that works reliably in all modern popular browsers.