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>