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:

http://pushingtheenvelope.ca/new/web.html

Would like to cycle the iFRAME choices.

Got this from experts-exchange.com 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() {
frameNo++;
if ( frameNo == myFrames.length ) frameNo = 0;
window.open(myFrames[frameNo], "frame_id");
myCycle = setTimeout("cycleFrames()", 1000*seconds);
}
function stopCycle() {
cleartimeout(myCycle);
}
</script>

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


gits
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:

[HTML]
<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')">
[/HTML]

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

[HTML]
<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();">
[/HTML]

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.