Using JavaScript to load multiple frames

So what good is it to cross-access objects, you ask? Well, one of the most popular uses of such is to load and change the content of more than one frame at one. Without JavaScript, there isn't a prayer. Lets say we have the following example:

<frameset cols="30%,70%">
<frame src="page1.htm" name="frame1">
<frame src="page2.htm" name="frame2">

We want to add a link in the first frame (page1.htm is in it) that will change the contents of not only page1, but page2 too. Ok, here we go: The below is the html file for page1:

<h1>This is page 1 </h1>
<a href="3.htm" onClick="parent.frame2.location='4.htm'">Click Here</a>

As you can see, this additional code will cause one link to perform two loading of pages.

Just for the hell of it, lets write a function that'll load 5 frames at once:

<script type="text/javascript">
function muchoframes(){

Nothing can stop you now!

Copyright 1997-2014 JavaScript Kit. NO PART may be reproduced without author's permission.