|
|
|
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.
good luck
|
|
| Builds JavaScript that updates the contents of one selector based on another. Categories : HTML, Java Script, PHP, Complete Programs, General | | | Javascript Background Scroller Categories : Java Script, CSS, HTML | | | How to create <SELECT> menues that change on the fly according to other <SELECT> menues on the page? Categories : Java Script, HTML | | | Prevent Right Mouse steal your graphics Categories : HTML, Java Script, Security | | | Cool tool tip Categories : Java Script, HTML, Web Design | | | Conditional Check - a script that allows a user to submit a form only if the user check a checkbox. Categories : HTML, Java Script, Form Processing, Beginner Guides | | | Javascript linked dropdowns Categories : Java Script, HTML, Classes and Objects | | | Javascript animated menu items Categories : DHTML, CSS, Java Script, HTML | | | Page Loading Message shown during the time your site's page is being loaded. Categories : HTML, CSS, Java Script | | | complete simply working javascript password generator file. Use letter, vowels, consonants (uppercase and lowercase) arrays to create a really random and secure password.
improved security using time functions to initialize random number generator. Categories : Java Script, HTML, Security, Authentication, Strings | | | Bookmarklets are simple tools that extend the surf and
search capabilities of Netscape and Explorer web browsers. Categories : Java Script, HTML, General | | | How to get the Focus (Cursor) into a Form-Element. Categories : HTML, Java Script | | | Show or Hide your Content using Javascript Categories : Java Script, HTML, CSS, Beginner Guides | | | Higly Customizable Javascript Calendar Script Categories : Java Script, Calendar, Date Time, HTML, CSS | | | Bouncing Marquee at Status Bar Categories : Java Script, HTML, Browsers | |
| | | | Sarah King wrote :992
this web page is essential reading for anyone using innerHTML
http://www.developer-x.com/content/innerhtml/
| |
|
|
|