About This Product
FontsMadeEasy.com
 
Search This Database:
| Over 5000 Free Fonts | Tutorials | Javascript Forum | Other Javascript Resources | Cheat Sheet
Tutorial archive
General Questions
Javascript 1.2
Navigation
Numbers
Strings
Object Model
Reference Manual
Dialog
Windows
Frames
Forms
Images
Mouse Events
Colors
File Access
Control Status Bar
Dates and Time
Cookies
Client Information
Bookmarklets


Updating two frames at a time

Question: Can I update two (or more) frames simultaneously?

Answer: Yes. The easiest way to update several frames simultaneously is to have a JavaScript function that loads a new page into each of the frames to be updated. For example, if you have two frames, left and right, then the function for updating both frames might look like this:

function updateBothFrames() {
 top.left.location="newpage1.htm";
 top.right.location="newpage2.htm";
}
This function can be called when the user presses a button or clicks a hyperlink. The following example shows the HTML code for a button and hyperlink that invoke the function:
<a href="javascript:updateBothFrames()">Click here</a>
<input type=button value="Press me" onClick="updateBothFrames()">

BackBack