hello again,
so i have a countdown in which i would like to add a automatically redirect to a specific url when timer hits 0 , as of now timer just goes into the negative..

<script type="text/javascript">

today = new Date();

BigDay = new Date("8,26,2012");
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
document.write("There are only<BR> <H4>" + daysLeft + " days " + hrsLeft +" hours and " + minsLeft + " minutes left </H4> Until 8,26,2012<P>");

</script>

thanks

Recommended Answers

All 2 Replies

    if (timeLeft < 0) {
    window.location = "http://www.google.com/"
    }

Add that to the end of your script it should do the trick.

yep it works perfectly thank you so much Sogo7.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.