Skip Navigation.

NWE Help: Web: Authoring: HTML: Tips: Frames

NWE Home :: Help :: Web :: Authoring :: HTML :: Tips

If you are working with frames and you want two windows to change at once, here's a simple script that allows that. (For more information about frames, see our frames help.)

Copy the following code and place it after the <Title> tag:

<script language="JavaScript">

<!-- Hide
var jsOK = false;
// -->

</script>
<script language="JavaScript1.1">

<!-- Hide
jsOK = true;
// -->

</script>
<script language="JavaScript">

<!-- Hide

function change_frames(doc1,doc2) {
parent.left.location.href=doc1+".html";
parent.middle.location.href=doc2+".html";
}

// -->

</script>
The part that states parent.left.location.href=doc1+".html"; means that you have a frame whose name is "left." Same thing exists for the middle indication. If your frames have different names, simply change these to whatever names you have already indicated.

Next, place the following script where the link that switches the frames is:

<a href="javascript:change_frames('page1','page2')">text</a>
Replace page1 and page2 with the names of the pages that will open in the frame locations. Notice that you don't write page.html. The script already allows for the .html extension.