I'm trying to create this module based on the specials one. The idea is to put a countdown timer over the special product that starts until the end of the discount.
At first I put the script on the php file and then a javascript function on the tpl. Here's the code:
[removed]
var days = '{$remainingDay}';
var hours = '{$remainingHour}';
var minutes = '{$remainingMinutes}';
var seconds = '{$remainingSeconds}';
{literal}
function setCountDown()
{
seconds--;
if (seconds < 0){
minutes--;
seconds = 59
}
if (minutes < 0){
hours--;
minutes = 59
}
if (hours < 0){
days--;
hours = 23
}
document.getElementById("remain") = days+" days, "+hours+" hours, "+minutes+" minutes, "+seconds+" seconds";
setTimeout ("setCountDown()", 1000 );
}
{/literal}
[removed]
The tpl file shows me correctly the time but it's not active, I mean it is not counting. This is because I need to load this js function and I don't know how to call it when the page is loaded. In a html file you can put the "onload" event in the <body> tag, but no way here.
How can I do this?. Is there any other way to create a function that loads on the page beginning?.
Thanks by your help.
Attached File(s)
Hot Price v0.8.1.zip (28bytes)
Number of downloads: 1660



Vous parlez français ?











