This example shows how to use the innerHTML Method of the Java Script Language .
with this method we can display content from one page in another .
What is this good for ?
Lets say that we would like to display a clock time which is based on the server and not on the
client and we want the clock time to refresh every X time with out refreshing all of the page .
so all we need to do is to create 2 pages :
The first page is the page that will display the clock and this page should contain a hidden iframe
by setting the width and height to 0 .
The iframe should point to the second page which holds the content that we would like to copy (in
our case is the clock function ) .
so in order to do that we are using a little java script like this in the second page :
<DIV id="ClockSrc">
<!-- This Is The Text That We Would Like To Copy From This Div To The Other Div . -->
<H1>here we should put the clock function that we would like to display </H1>
</DIV>
<script>
// THIS SCRIPT WILL COPY THE CONTENT OF THE ClockSrc DIV INTO THE ClockDiv IN THE UPPER PAGE.
parent.document.all('ClockDiv').innerHTML = document.all('ClockSrc').innerHTML;
</script>
Please see the attached file for a working example.