Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

have two frames in a row change position randomly

Status
Not open for further replies.

robertd18

Technical User
Jan 14, 2003
32
US
hi what i mean is how do i program a web page that is using frames to randomly present two frames in random order
 
Store all your frame URLs in an array:
Code:
var frameURLs = new Array('frame1.html', 'frame2.html', 'frame3.html', 'frame4.html','frame5.html');

Then set the source of each frame randomly:
Code:
function setframes(){
 document.frames[0].src = frameURLs[Math.floor(Math.random()*frameURLs.length];
  document.frames[1].src = frameURLs[Math.floor(Math.random()*frameURLs.length];
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top