Thanks Nick your a great help. However I need this script to count down, not up. Now, I have found the following script that does what I want. It countsdown from 10 mins (or however many mins are specified at the top).
But this starts counting from the current time. I need it to count from the time in the cookie. Ive tried to alter this script for the past 3 hours but im getting nowhere. :crying: :crying:
So....I need on the first page to set the cookie.
I then need to change the following script to take the time from the cookie and count down from there instead of the current time.
Without pushing my luck, ideally I need the script to re-direct to a new set page when the counter reaches 0:00
PHP Code:
<HTML>
<HEAD>
<TITLE>Countdown Clock</TITLE>
<SCRIPT>
<!--
var timeInMin = "30"; //The minutes the count down should run.
var theDay = new Date()
var countDown = theDay.getTime()+(1000*60*timeInMin);
var TimeTill //The string that is going to put all numbers together and make sense.
function countdown()
{
var today = new Date() //Create an Date Object that contains today's date.
var second = Math.floor((countDown - today.getTime())/1000)
/*Use getTime() to get the milisecond (1/1000 of a second) from now to theDay.
and devide it into 1000 to get the seconds from now to theDay.*/
var minute = Math.floor(second/60) //Devide "second" into 60 to get the minute
var hour = Math.floor(minute/60) //Devide "minute" into 60 to get the hour
var day = Math.floor(hour/24) //Devide "hour" into 60 to get the day
CDay= day //Correct day
CHour= hour % 24 //Correct hour, after devide into 24, the remainder deposits here.
CMinute= minute % 60 //Correct minute, after devide into 60, the remainder deposits here.
CSecond= second % 60 //Correct second, after devide into 60, the remainder deposits here.
var TimeTill = "";
if(CDay)
{
TimeTill += CDay + ":";
}
if(CHour || CDay)
{
if(CHour < 10)
{
TimeTill += "0";
}
TimeTill += CHour + ":";
}
if(CMinute < 10)
{
TimeTill += "0";
}
TimeTill += CMinute + ":";
if(CSecond < 10)
{
TimeTill += "0";
}
TimeTill += CSecond;
document.clock.countdown.value = TimeTill //Make the particular form chart become "Daytill"
var counter = setTimeout("countdown()", 1000) //Create the timer "counter" that will automatic restart function countdown() again every second.
}
//-->
</SCRIPT>
</HEAD>
<BODY onLoad = "countdown()">
<FORM NAME = "clock">
<INPUT TYPE="TEXT" NAME="countdown" size="20" class="abc"><BR>
</FORM>
</BODY>
</HTML>
Bookmarks