I created a countdown clock for a jewel of the day promotion on my website. I’ve had a few people ask for the code, so I figured I would share it with everyone.
I do have one problem with it. The javascript will not display numbers 0 through 9 as 01 through 09. Besides that, it works rather well.
I created a php file which I call.
{php}
$Hour = ‘%H’;
$Min = ‘%M’;
$Sec = ‘%S’;
$strfH = strftime($Hour);
$strfM = strftime($Min);
$strfS = strftime($Sec);
$mHour = 23;
$mMin = 59;
$mSec = 59;
$hourClock = $mHour-$strfH;
$minClock = $mMin-$strfM;
$secClock = $mSec-$strfS;
{/php}
This php file passes variables to the browser. Javascript takes over and uses the variables to display the clock. Here is the javascript code that I wrote:
<input class="clock_input" style="border: 0" type="text" size="8"
name="d2"/>
name="d2"/>
Here is the link to the code in action:
[url]http://www.shipfreejewelry.com[/url]
If you have any suggestions on padding the single digit numbers, I am more than interested.
I hope this can help someone out,
Jeff