The Script Approach to Active Client Pages: Chrys`s Enhancement - The innerHTML Property
(Page 3 of 4 )
Now that you are producing the content at the client, it might interest you to be able to change the content of HTML elements. You probably already knew that you could change the table cell content with the innerHTML property. Many browsers today can allow you to change the content of almost any HTML element.
Consider the following code:
<html>
<head>
<script type="text/javascript">
function changeContent()
{
document.getElementById('S1').innerHTML = "two";
document.getElementById('D1').innerHTML = "second";
}
</script>
</head>
<body>
<span id="S1">one</span>
<div id="D1">First</div>
<button type="button" onclick="changeContent()">Click</button>
</body>
</html>
When you click the button, the contents of the SPAN and DIV elements will be changed by the function in the script. This is just to show you that now, as your web pages or forms would be produced at the client, you may have to change the contents of HTML elements. This feature is not imperative for ACP. It comes as a complement. You can try the above code.
Next: Summary of ACP >>
More JavaScript Articles
More By Chrysanthus Forcha