Log in

View Full Version : advanced countdown



motox5874
11-12-2009, 07:14 PM
hi. i'm in need of some help with a countdown script.

"orders completed in the next [time] ship out [date]"

this needs to count down every day;
[time] counting down to 1pm every day (resetting immediately), if it is past 1pm then the [date] needs to display "during the next business day", and if it is before 1pm then it needs to say "today"

example;

it's noon - "orders completed in the next 1 hour ship today"
it's 3pm - "orders completed in the next 21 hours ship during the next business day"

is this possible on a non php page, or at all?

thanks very much for any help.

brian

vwphillips
11-13-2009, 10:41 AM
this does not acount for time zones or weekends


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/
function Shipping(id){
var today=new Date();
var hours=today.getHours();
var day=today.getDay();
document.getElementById(id).innerHTML=(hours<13)?'orders completed in the next '+(13-hours)+' hour ship today':'orders completed in the next 21 hours ship during the next business day';
}

/*]]>*/
</script></head>

<body>

<span id="tst" ></span>
<script type="text/javascript">
/*<![CDATA[*/
Shipping('tst');
/*]]>*/
</script>
</body>

</html>