By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

iFRAME auto-cycle code

P: 1
Trying to figure out how to auto-cycle an iFRAME.

Here is the link in question:

Would like to cycle the iFRAME choices.

Got this from however:

1. Dreamweaver is not color-coding it correctly after line one so I am thinking there is something wrong with it?

2. I have a rollover javascript in place - am I to place this in a new <script></script> entry or within the other one?

<script type="text/Javascript">
var myFrames = new Array("frame1.html", frame2.html", "etc");
var frameNo = 0; //Frame to start on
var seconds = 5; //Number of seconds between frames
var myCycle; //Do not change
function cycleFrames() {
if ( frameNo == myFrames.length ) frameNo = 0;[frameNo], "frame_id");
myCycle = setTimeout("cycleFrames()", 1000*seconds);
function stopCycle() {

Thanks. Obviously I know crap when it comes to coding.
Jun 17 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 5,390
hi ...

the code should work ... but you have to call your cycleFrames-function ;) search the 'onload'-handler of your document body, it looks like:

<body onload="MM_preloadImages('images/menu/home-on.gif','images/menu/services-on.gif','images/menu/about-on.gif','images/menu/testimonials-on.gif','images/menu/contact-on.gif','images/menu/webdesign-on.gif','images/menu/printdesign-on.gif','images/menu/photography-on.gif')">

at the end, add the call to your cycleFrames-function (note the semicolons):

<body onload="MM_preloadImages('images/menu/home-on.gif','images/menu/services-on.gif','images/menu/about-on.gif','images/menu/testimonials-on.gif','images/menu/contact-on.gif','images/menu/webdesign-on.gif','images/menu/printdesign-on.gif','images/menu/photography-on.gif'); cycleFrames();">

try it ... it should work ...

kind regards ....
Jun 17 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.