|Replacing Page Content|
This sentence is about to change, depending on what the user types in to the text box.
<div id=ThisWillChange>This sentence is about to change,
depending on what the user types in to the text box.
<input id=TextField type=text style="width:550">
<input type=button value="Click me to change"
innerHTML = TextField.value">
The innerHTML property says whatever appears on the page as HTML content between the start and close of the referenced ID will be affected by the operation. In this case, it's replaced by a value the input form returns. If a user includes HTML code in her input, the output will be rendered accordingly. Change the property to innerText and the same output will display the HTML code along with the output. Hint: This is a good start toward building an interactive HTML tutorial: Users can type in code, click on a button, and see the results instantly.