Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CodeMod Help

Status
Not open for further replies.

elead

Technical User
Apr 20, 2001
38
US
I need help to modify the code below so that after 5 minutes of refreshing itself using this logic it forwards to another web page--Thanks

<script>
<!--

//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="0:10"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}

//window.onload=beginrefresh
//-->
</script>
 
Your best bet is probably to pass a number in the URL indicating which number of page refreshes the viewer is on, then when the total time (page refreshes times refresh interval) is greater than or equals the preset limit, the browser goes to the next page.

You could also put the refreshing page inside a frame that fills the entire page, then the outer page can have the timer set to go to the next page while the page in the frame reloads over and over.

If you choose the latter method, you don't need to use Javascript (use META tags), which means you can achieve your purpose even with browsers with Javascript turned off.

Lee
 
You could use session variables (server-side if that was available)... or even client-side cookies to record the number of "refreshes" on a specific page.

The world is your oyster!

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top