Normally such a thing is almost always done using a server side script (you know why), but since you have been nice in your conduct on Daniweb, I would try something out for you. :)
How about something like:
<!--
author: Sanjay aka ~s.o.s~
A simple redirection script which runs on the client side.
-->
<html>
<head>
<style>
.myDiv
{
text-align: center;
font: italic small-caps 900 14px arial
}
</style>
<script>
var count = 5;
var timerHandle;
var URL = " <a href="http://www.yahoo.com">http://www.yahoo.com</a> ";
var SITE_NAME = "Yahoo";
function startCountDown()
{
update();
timerHandle = setInterval("update()", 1000);
}
function update()
{
if(count <= 0)
{
clearInterval(timerHandle);
document.getElementById('txt').innerHTML = 'Redirecting, please wait...';
window.location.assign(URL);
/*
You can also use the window.location.replace() function with the difference
being you won't be able to hit the back button once the new page has been
loaded. Use the function which suits your purpose
*/
}
else
{
//you can also embed the entire message in a 'anchor' tag so that the user can decide not to
//wait and click on the link to go to the site.
document.getElementById('txt').innerHTML = 'You would be redirected to '+ SITE_NAME + ' in ' + count + ' seconds.';
--count;
}
}
</script>
</head>
<body onload="javascript:startCountDown();">
<div class="myDiv" id="txt"></div>
</body>
</html>
Just let me know if it works for your cause. ;-)
~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734