PDA

View Full Version : Url Reload In a frameset.


tim_ver
08-04-2005, 12:33 AM
I want to have a url load in the bottom frame of a page.

I have a webpage with two frames a small top frame"frame1" and the bottom frame "frame2" I want the top "frame1" to have an image and the code in it, and then the url to reload in the bottom frame "frame2" every 2mins. I have the banner image done but can not get the url to reload in the bottom frame. I had this code and it worked fine but loaded in the same page and only once, I figured this is why I need the frames so it loads in the bottom frame each time. I also would like a small hit counter in the top frame that shows how many times it has refreshed the page. Thanks. Help please.

Here is the code I have now.

<script language="JavaScript">
<!--
var time = null
function move() {
window.location = 'http://www.cnn.com/'
}
//-->
</script><body onload="timer=setTimeout('move()',200000)">

shyam
08-04-2005, 01:38 AM
<script language="JavaScript">
<!--
var time = null
var refreshCount = 0;
function move() {
if ( window.top.frames ) {
window.top.frames["frame2"].location.href = 'http://www.cnn.com/';
refreshCount++;
}
}
//-->
</script><body onload="timer=setInterval('move()',200000)">

tim_ver
08-04-2005, 03:58 AM
Ok, thanks.

I pasted the code in but nothing happens.
And I get the error icon bottom left of page.

Can you upload the whole page please with the code. I am missing something here.


Also do I have to set a value for this instead of 0?

var refreshCount = 0;



Thanks
:)

shyam
08-04-2005, 11:27 AM
worx for me...is there some issue with IE or something ?

index.htm
<html>
<frameset cols="200,*">
<frame src="frame1.htm" name="frame1">
<frame src="frame2.htm" name="frame2">
</frameset>
</html>

frame1.htm
<html>
<head>
<script language="JavaScript">
<!--
var timer = null;
var refreshCount = 0;
function move() {
if ( window.top.frames ) {
//alert("move");
window.top.frames["frame2"].location.href = 'http://www.cnn.com/';
refreshCount++;
}
}
function start() {
//alert("start");
timer = setInterval('move()',5000);
}
//-->
</script>
</head>
<body onload="start()">
hi i'm frame 1
</body>
</html>

frame2.htm
<html>
<head>
</head>
<body>
Hi i'm frame 2
</body>
</html>

tim_ver
08-04-2005, 07:25 PM
Ok it works. Is there a easy way to add a counter for every refresh that is done?

Is 500000 5mins?

Also this will refresh ever 5 mins forever right?

Thanks

oldcrazylegs
02-14-2006, 09:17 PM
I'd like to have this same thing. But I want a top frame with the code in it and two bottom frames to each be refreshed every 5 minutes. Thanks.

oldcrazylegs
02-15-2006, 09:45 PM
I figured it out already. I changed move() to move1() and made another move2().

Lerura
02-16-2006, 12:13 AM
the timer is set in milliseconds

5 minutes of 60 seconds of 1000 milliseconds

5 mins = 5*60*1000 = 300000 milliseconds