Click to See Complete Forum and Search --> : Simple count
alexthomas
02-19-2003, 08:33 AM
I need a simple count function so that i can peform tasks on a specified time i.e.
on 10secs load 1.htm
on 15secs load 2.htm
on 20secs load 3.htm
etc.
Can anyone help? Please...
Al :D
gil davis
02-19-2003, 08:49 AM
<head>
<script>
function init() {
setTimeout("window.top.main.location.href = '1.htm'", 10 * 1000);
setTimeout("window.top.main.location.href = '2.htm'", 15 * 1000);
setTimeout("window.top.main.location.href = '3.htm'", 20 * 1000);
}
</script>
</head>
<frameset rows="100%,*" onload="init()">
<frame name="main" src="0.htm">
</frameset>
alexthomas
02-19-2003, 08:58 AM
Okay,
i've put that in, but when i load it i get the good old
"Page cannot be displayed" error
is this part of the code you gave corect?
<frameset rows="100%,*" onload="init()">
<frame name="main" src="0.htm">
</frameset>
If so, what should the 0.htm be?
Regards
gil davis
02-19-2003, 09:16 AM
what should the 0.htm be?Whatever you want the first page to be. You weren't specific about how things start. Whatever is supposed to be there for the first ten seconds.
alexthomas
02-19-2003, 09:22 AM
ah thats excelent,
one more thing, how can i loop.
so once i have reached the last time ie 18secs it resets and starts again from 0?
gil davis
02-19-2003, 10:08 AM
Your request is outside the realm of possibilities. You cannot show something for 10 seconds then something else for 5 seconds (15-10) then another thing for 5 seconds (20-15) but start the sequence over again within 18 seconds.
This is what I thought you originally asked for, and what my code will do:
0-10 seconds = 0.htm
10-15 seconds = 1.htm
15-20 seconds = 2.htm
20-? seconds = 3.htm
So, how long do you want 3.htm to appear before stating the loop over and showing 0.htm?
alexthomas
02-19-2003, 10:29 AM
Please See attached file, this will help explain.
Basicaly, i have six frames, each contains one page which calls three other pages, ie.
Frame1 Contains:
Frame1.htm which calls; frame1a.htm, frame1b.htm, frame1c.htm
Frame2 Contains:
Frame2.htm Which calls; frame2a.htm, frame2b.htm....etc...
What i would like to do is:
Zero seconds frame1 calls frame1a.htm,
5secs Frame2 calls frame2a.htm
10secs Frame3 calls frame3a.htm
¦
¦
¦
85secs Frame6 calls frame6c.htm
90secs at this point i would like the counter to reset to zero and loop through the pages again. I can get the pages to loop through once, using the following code on each page (frame1a.htm....etc...)
<html>
<head>
<title> Frame 1a </title>
<script language="JavaScript">
function init() {
setTimeout("window.main.location.href = 'frame1a.htm'", 0 * 1000);
setTimeout("window.main.location.href = 'frame1b.htm'", 6 * 1000);
setTimeout("window.main.location.href = 'frame1c.htm'", 12 * 1000);
}
</script>
</head>
<frameset rows="100%,*" onload="init()">
<frame name="main" src="0.htm">
</frameset>
</html>
Sorry that i was missleading in the first place, does this help explain my situation any better? if so can you help?
Regards
gil davis
02-19-2003, 11:46 AM
<html>
<head>
<title> Frame 1a </title>
<script language="JavaScript">
var first = true;
function init() {
if (first)
{first = false;
setInterval("init()", 18 * 1000);}
setTimeout("window.main.location.href = 'frame1a.htm'", 0 * 1000);
setTimeout("window.main.location.href = 'frame1b.htm'", 6 * 1000);
setTimeout("window.main.location.href = 'frame1c.htm'", 12 * 1000);
}
</script>
</head>
<frameset rows="100%,*" onload="init()">
<frame name="main" src="0.htm">
</frameset>
</html>
alexthomas
02-20-2003, 03:39 AM
Thats excelent, thst works perfectly, thanks for all your help
:cool: :D