How do I change multiple frames simultaneously with one click?
Created May 4, 2012
Jayesh Nazre Every frame is considered to be a window object.
So you can change the frames contents using all of the window objects functions.
Now all the frames in a window are considered to be in a collection array.
Say you have three frames fr1,fr2,fr3 .
You can access them using the following code
parent.frames["fr1"] parent.frames["fr2"] parent.frames["fr3"]or as:
parent.frames[0] parent.frames[1] parent.frames[2]So if you want to change multiple frames, then in the onClick of a button call a JavaScript function (eg - test()) and change the frames as shown
<script language=test()> function test() { parent.frames["fr1"].location = "1.html"; parent.frames["fr2"].location = "1.html"; parent.frames["fr3"].location = "1.html"; } </script>or as:
<script language=test()> function test() { parent.frames[0].location = "1.html"; parent.frames[1].location = "1.html"; parent.frames[2].location = "1.html"; } </script>