Click to See Complete Forum and Search --> : timed page change in frame and looping pages in frame
Andde78
05-11-2004, 01:22 AM
Hi,
i am trying to design a system with following,
data in server, i have 2 pages i need,
say A and B then i have frames
frames top is hidden control frame,
which should control frame "data",
i want to open in frame "data" page A for 5 mins and then open page B 5mins, page A 5mins, page B 5mins... etc..
so how do i open pages from my control frame so that they are in a loop and timed change for pages?
Pittimann
05-11-2004, 02:03 AM
Hi!
If the only reason for your using of frames is to have a hidden frame controlling the "main" frame in the way you described, just leave out using frames. You can do the redirect in your two files "page A" and "page B":
pageA.htm<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
var howLong=20;//time before redirect in seconds
howLong*=1000;
function redirect(){
setTimeout('location.href="pageB.htm"',howLong);
}
//-->
</script>
</head>
<body onload="redirect()">
page A
</body>
</html>pageB.htm<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
var howLong=20;//time before redirect in seconds
howLong*=1000;
function redirect(){
setTimeout('location.href="pageA.htm"',howLong);
}
//-->
</script>
</head>
<body onload="redirect()">
page B
</body>
</html>Cheers - Pit
Andde78
05-11-2004, 02:27 AM
cheers m8,
this works,
but but..
i have 2 pages, both have redirects to url,
Page A
location.href="https://exel.syncrontech.net/1.html"
and
Page B
location.href="https://exel.syncrontech.net/2.html"
about like this with the code Pit shared,
was wondering how can i get the redirection to work when my redirection goes to url, not my another page..
does some1 have suggestions?
Pit?
cheers in adv,
Andde
Pittimann
05-11-2004, 02:33 AM
Hi!
Does that mean, the pages you redirect to are not yours and that you cannot modify them?
Cheers - Pit
Andde78
05-11-2004, 02:38 AM
Hi,
yes,
i cant modify the pages i redirect to..
but i need to use 2 pages and loop them so
that they change every 5 mins,
Andde78
05-11-2004, 02:54 AM
Hi again,
Yo Pit,
would this work,
third page where a script, (control frame?)
loop,
open page A
time 5 min,
open page B,
time 5min,
repeat?
it would be good if it would be an infinite loop..
how do you do this?
cheers,
Andde
Andde78
05-11-2004, 03:17 AM
So my idea was a bit like this,
i = 0
while (i < 5) //creates infinite loop
{ //open page 1
parent.frame(2).location.href="viikkoreportti.html"
// some kind of sleep func
var j=0;
function countNum() {
if (j<=10){ document.write(j);j++; }
else { stopCount(); }
timeout=setTimeout("countNum()",5);
}
function stopCount() {
clearTimeout(timeout);
}
countNum();
//open page2
parent.frame(2).location.href="kuukausireportti.html"
//same sleep func
var j=0;
function countNum() {
if (j<=100){ document.write(j);j++; }
else { stopCount(); }
timeout=setTimeout("countNum()",50);
}
function stopCount() {
clearTimeout(timeout);
}
countNum();
}
does this **** work,
or how do i do the sleep in between the page loads?
Cheers,
Andde
Pittimann
05-11-2004, 03:31 AM
Hi!
I set up something which does what you want. Unzip the files in the zip attached to one folder.
pageAAA.htm: frameset document
pageAA.htm: in hidden frame doing the redirect to pageA.htm and pageB.htm.
pageA.htm: redirects to pageA1.htm
pageB.htm: redirects to pageB1.htm
If you replace pageA1.htm and pageB1.htm with the files you really want to display, you should be where you want to be...
Cheers - Pit
Andde78
05-11-2004, 04:13 AM
works like charm,
big thx, mate,
works great, i am happy, thx.
Pittimann
05-11-2004, 04:18 AM
Hi!
You're welcome ;)
I did not understand, why you need two own files to redirect to the files not belonging to you. Referring to my example, you could keep things smaller by having the pageAA.htm call the files in question directly:
<script language="JavaScript" type="text/javascript">
<!--
var howLong=20;//time before redirect in seconds
howLong*=1000;
var count=0;
function redirect(){
count+=1000;
if (count==howLong){
top.frames.data.location.href="pageB1.htm";
}
if (count==howLong*2){
top.frames.data.location.href="pageA1.htm";
count=0;
}
setTimeout('redirect()',1000);
}
//-->
</script>
If that makes sense for you, just skip the two files pageA.htm and pageB.htm...
Cheers - Pit
Andde78
05-11-2004, 05:49 AM
oh well,
my brain just is jammed.. :)
i actually did just what you said,
and made it a little bit smaller,
works great though,
it is going to show 2 different reports,
1. week report,
2. month report,
works now, and your help was more than needed,
bit noob with javascript.. :)
Pittimann
05-11-2004, 05:53 AM
Hi!bit noob with javascript..Nobody here, who never wasn't a noob, so that's not a crime :p
Cheers & good luck - Pit