PDA

View Full Version : Universal Countdown Script



diamante
01-07-2009, 01:02 PM
1) Script Title:
Universal Countdown Script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex6/universalcountdown.htm

3) Describe problem:
I'm trying to create a web page with 5 countdown
but the target date is different for every div.
i tryied changing only this part of the body for 2 different target but i can see only one countdown:

var launchdate=new cdLocalTime("cdcontainer", "server-php", 0, "April 23, 2010 15:53:00", "debugmode")
launchdate.displaycountdown("days", formatresults2)
var launchdate=new cdLocalTime("cdcontainer", "server-php", 0, "April 24, 2010 15:53:00", "debugmode")
launchdate.displaycountdown("days", formatresults2):confused:

i know that i can use the code five times changing only the functions name but it will be too heavy for the site..
do you know a better solution?
thank you:)

Nile
01-07-2009, 01:06 PM
You'd have to change the name of the variable every time(see highlighted):


var launchdate0=new cdLocalTime("cdcontainer", "server-php", 0, "April 23, 2010 15:53:00", "debugmode")
launchdate.displaycountdown("days", formatresults2),
launchdate1=new cdLocalTime("cdcontainer", "server-php", 0, "April 24, 2010 15:53:00", "debugmode")
launchdate.displaycountdown("days", formatresults2);

diamante
01-07-2009, 01:32 PM
I tryied with that code but it still doesn't work
i can see not more than 1 countdown...

jscheuer1
01-07-2009, 04:01 PM
<div id="cdcontainer0">

</div>

<div id="cdcontainer1">

</div>

<script type="text/javascript">
var launchdate0=new cdLocalTime("cdcontainer0", "server-php", 0, "April 23, 2010 15:53:00", "debugmode");
launchdate0.displaycountdown("days", formatresults2);
var launchdate1=new cdLocalTime("cdcontainer1", "server-php", 0, "April 24, 2010 15:53:00", "debugmode");
launchdate1.displaycountdown("days", formatresults2);
</script>

diamante
01-07-2009, 04:09 PM
thank you very much:):)
you are the best:cool:

Nile
01-07-2009, 10:35 PM
Ahh - yes, if you don't see what John did. He also changed the container div of the clock - this is something I forgot to do.