Changing page by timer

E

Ed

I have a website and want to emphasize some major changes that have taken
place in the event it represents. I want to open with a very simple page
with just the changed information on it, with a counter that changes to the
master website after 'x' time, or the user can change manually. I've seen
this done many times.

Where can I learn to do this? Everything I search for gives me countdown
timers and such.

Thanks for any help you can offer.
 
T

Trevor Lawrence

Ed said:
I have a website and want to emphasize some major changes that have taken
place in the event it represents. I want to open with a very simple page
with just the changed information on it, with a counter that changes to the
master website after 'x' time, or the user can change manually. I've seen
this done many times.

Where can I learn to do this? Everything I search for gives me countdown
timers and such.

Thanks for any help you can offer.

This may be a bit rough and ready but it works

<html>
<head>
<script language="JavaScript">
// Enter Location here
var newlocn = "http://mysite.domain.com"

// Enter time here
var mins = 10 , secs = 0

/*** Do Not Alter rest of code ***/
var start=new Date();
start=Date.parse(start)/1000;

function reset()
{
with (document.form1)
{ clock3.value = 0;
clock4.value = 0 ; }
}

function SetUp()
{
with (document.form1)
{ mins = +clock3.value;
secs = +clock4.value; }
start=new Date();
start=Date.parse(start)/1000;
setTimeout("CountDown(mins,secs)", 100)
}

function CountDown(mins,secs)
{
var now = new Date();
now = Date.parse(now)/1000;
var x = parseInt(mins*60 + secs -(now-start),10);

var min = parseInt(x/60,10)
var sec = x % 60

document.getElementById("clock1").value = min;
document.getElementById("clock2").value = sec;

if(x>0)
setTimeout("CountDown(mins,secs)", 100)
else {
document.getElementById("msg").innerHTML = 'Redirect'
setTimeout("location.href=newlocn",2000)
}
}
window.setTimeout('CountDown(mins,secs)',100);
</script>
</head>

<body style="text-align:center" onload="reset()">

<form name="form1">
You are being redirected to
<script>document.write('<a href="' + newlocn + '">' + newlocn +
'</a>')</script>
in <input type="text" id="clock1" size="2" value=""> minutes
and <input type="text" id="clock2" size="2" value=""> seconds.
<p>
Set new time<br />
<input type="text" id="clock3" size="2" value="0"> minutes
and <input type="text" id="clock4" size="2" value="0"> seconds.<br />
<input type="button" id="Settime" value="Set Time"
onclick="SetUp()" >
<div id ="msg" style="font:300%"></div>
</p>
</form>

</body>
</html>
 
K

Karl E. Peterson

Ed said:
I have a website and want to emphasize some major changes that have taken
place in the event it represents. I want to open with a very simple page
with just the changed information on it, with a counter that changes to the
master website after 'x' time, or the user can change manually. I've seen
this done many times.

Where can I learn to do this? Everything I search for gives me countdown
timers and such.

I'm pretty sure, if you're still around, this is what you're looking for:

http://en.wikipedia.org/wiki/Meta_refresh
 
T

Trevor Lawrence

Karl,
This is the simple answer to a redirect, but the OP wrote "or the user can
change manually", which is why I wrote and posted a script to do it. I
encountered a few problems in passing the parameters, but in the end it
seemed to work OK
 
K

Karl E. Peterson

Trevor said:
This is the simple answer to a redirect, but the OP wrote "or the user can
change manually", which is why I wrote and posted a script to do it. I
encountered a few problems in passing the parameters, but in the end it
seemed to work OK

I'm not sure I understand the distinction you're trying to make. You just set the
refresh interval to something like 10 or 15 seconds, then in the visible text tell
the user that the content has moved and provide a link they click if they'd rather
not wait. For example, on servers that don't make it easy to disallow browsing
folders without a default document:

<html>
<head>
<meta http-equiv="Refresh" content="10; URL=/">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Go Away</title>
</head>

<body>
<p align="center"><a href="/">
<img src="noentry.gif" border="0" alt="What are you looking for, anyway?">
</a></p>
</body>
</html>

Why mess with a script?
 
T

Trevor Lawrence

Karl E. Peterson said:
I'm not sure I understand the distinction you're trying to make. You just
set the refresh interval to something like 10 or 15 seconds, then in the
visible text tell the user that the content has moved and provide a link
they click if they'd rather not wait. For example, on servers that don't
make it easy to disallow browsing folders without a default document:

Yes, of course.

I must have been carried away by using JS for no advantage. Doing this won't
present a counter, but then most people either
1. Have a watch , or
2. Can look at the clock in the taskbar, or
3. Can count in their head

The OP hasn't replied, so I guess the thread is well and truly dead.

<non-sarcastic>
Thanks for pointing out the obvious.
</non-sarcastic>
 
K

Karl E. Peterson

Trevor said:
<non-sarcastic>
Thanks for pointing out the obvious.
</non-sarcastic>

Heheheheh... Can't tell you how many times I've written code because I could rather
than because I should. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top