JavaScript : Links Modifying Several Frames
Contents ]
Dr Benton

Main Page Definition

HTML does allow the creation of links with different behaviours - for instance displaying a page in a new window or a specific window - but nothing has been envisaged for changing pages in two (or more) frames simultaneously when a link is activated.

To do this, you have to intercept the link activation by means of the onClick event, and dynamically load the content of the two frames with the help of a few lines of JavaScript.

In this workshop, we start off with the following HTML page code:

<HTML>
<FRAMESET ROWS="50,*">
<FRAME SRC="frame_1.htm" name="frame_1">
<FRAMESET COLS="150,*">
<FRAME SRC="frame_2.htm" name="frame_2">
<FRAME SRC="frame_3.htm" name="frame_3">
</FRAMESET>
</FRAMESET>
</HTML>

Note that this page references three other separate pages, each displayed in its own frame. The names assigned to the frames are for addressing purposes.

Addressing an element. Addressing an object means accessing it via its address, or a symbolic name as is the case here.

Paste this code in an empty text document and save it under the name index.htm.



1   2   3