Click to See Complete Forum and Search --> : More than one Countdown-Timer on one side ...


Hase
03-04-2003, 04:57 AM
Hello everybody,

i have to create a page with lots of countdowntimer but i get always only 1 to run.

I used the following Timer:
http://javascript.internet.com/clocks/digital-countdown.html

I tried to rename the arrays in cb0 and such but doesn't work.

So how can i get more than 1 timer with different Countdown-Dates to run on one side?

Thanks for any help.

Hase

Hase
03-04-2003, 07:28 AM
Thanks for the answer and for the links, i changed the code now to the following:

function getTime() {
c1 = new Image(); c1.src = "1c.gif";
c2 = new Image(); c2.src = "2c.gif";
c3 = new Image(); c3.src = "3c.gif";
c4 = new Image(); c4.src = "4c.gif";
c5 = new Image(); c5.src = "5c.gif";
c6 = new Image(); c6.src = "6c.gif";
c7 = new Image(); c7.src = "7c.gif";
c8 = new Image(); c8.src = "8c.gif";
c9 = new Image(); c9.src = "9c.gif";
c0 = new Image(); c0.src = "0c.gif";
Cc = new Image(); Cc.src = "Cc.gif";
now = new Date();
SecDate = new SecDate();

//ENTER BELOW THE DATE YOU WISH TO COUNTDOWN TO
auktion1 = new Date("Jan 1 2004 0:00:01");
auktion2 = new SecDate("Mar 3 2003 0:00:01");

days = (auktion1 - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (auktion1 - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (auktion1 - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (auktion1 - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);

days = (auktion2 - SecDate) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (auktion2 - SecDate) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (auktion2 - SecDate) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (auktion2 - SecDate) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);

if (secondsRound <= 9) {
document.images.g.src = c0.src;
document.images.h.src = eval("c"+secondsRound+".src");

document.images.g1.src = c0.src;
document.images.h1.src = eval("c"+secondsRound+".src");
}
else {
document.images.g.src = eval("c"+Math.floor(secondsRound/10)+".src");
document.images.h.src = eval("c"+(secondsRound%10)+".src");

document.images.g1.src = eval("c"+Math.floor(secondsRound/10)+".src");
document.images.h1.src = eval("c"+(secondsRound%10)+".src");
}
if (minutesRound <= 9) {
document.images.d.src = c0.src;
document.images.e.src = eval("c"+minutesRound+".src");

document.images.d1.src = c0.src;
document.images.e1.src = eval("c"+minutesRound+".src");
}
else {
document.images.d.src = eval("c"+Math.floor(minutesRound/10)+".src");
document.images.e.src = eval("c"+(minutesRound%10)+".src");

document.images.d1.src = eval("c"+Math.floor(minutesRound/10)+".src");
document.images.e1.src = eval("c"+(minutesRound%10)+".src");
}
if (hoursRound <= 9) {
document.images.y.src = c0.src;
document.images.z.src = eval("c"+hoursRound+".src");

document.images.y1.src = c0.src;
document.images.z1.src = eval("c"+hoursRound+".src");
}
else {
document.images.y.src = eval("c"+Math.floor(hoursRound/10)+".src");
document.images.z.src = eval("c"+(hoursRound%10)+".src");

document.images.y1.src = eval("c"+Math.floor(hoursRound/10)+".src");
document.images.z1.src = eval("c"+(hoursRound%10)+".src");
}
if (daysRound <= 9) {
document.images.x.src = c0.src;
document.images.a.src = c0.src;
document.images.b.src = eval("c"+daysRound+".src");

document.images.x1.src = c0.src;
document.images.a1.src = c0.src;
document.images.b1.src = eval("c"+daysRound+".src");
}
if (daysRound <= 99) {
document.images.x.src = c0.src;
document.images.a.src = eval("c"+Math.floor((daysRound/10)%10)+".src");
document.images.b.src = eval("c"+Math.floor(daysRound%10)+".src");

document.images.x1.src = c0.src;
document.images.a1.src = eval("c"+Math.floor((daysRound/10)%10)+".src");
document.images.b1.src = eval("c"+Math.floor(daysRound%10)+".src");
}
if (daysRound <= 999){
document.images.x.src = eval("c"+Math.floor(daysRound/100)+".src");
document.images.a.src = eval("c"+Math.floor((daysRound/10)%10)+".src");
document.images.b.src = eval("c"+Math.floor(daysRound%10)+".src");

document.images.x1.src = eval("c"+Math.floor(daysRound/100)+".src");
document.images.a1.src = eval("c"+Math.floor((daysRound/10)%10)+".src");
document.images.b1.src = eval("c"+Math.floor(daysRound%10)+".src");
}
newtime = window.setTimeout("getTime();", 1000);
}
// End -->
</script>

</HEAD>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

<BODY onLoad="getTime()">

<!-- STEP THREE: Copy this code into the BODY of your HTML document -->

<div align="center">
<h3>Countdown to New Years (2004)</h3>
</div>

<center>
<table><tr><td bgcolor="black" valign="bottom">
<img height=21 src="0c.gif" width=16 name=x>
<img height=21 src="0c.gif" width=16 name=a>
<img height=21 src="0c.gif" width=16 name=b>
<img height=21 src="Cc.gif" width=9 name=c>
<img height=21 src="0c.gif" width=16 name=y>
<img height=21 src="0c.gif" width=16 name=z>
<img height=21 src="Cc.gif" width=9 name=cz>
<img height=21 src="0c.gif" width=16 name=d>
<img height=21 src="0c.gif" width=16 name=e>
<img height=21 src="Cc.gif" width=9 name=f>
<img height=21 src="0c.gif" width=16 name=g>
<img height=21 src="0c.gif" width=16 name=h>
</td></tr></table>
</center>

<center>
<table><tr><td bgcolor="black" valign="bottom">
<img height=21 src="0c.gif" width=16 name=x1>
<img height=21 src="0c.gif" width=16 name=a1>
<img height=21 src="0c.gif" width=16 name=b1>
<img height=21 src="Cc.gif" width=9 name=c1>
<img height=21 src="0c.gif" width=16 name=y1>
<img height=21 src="0c.gif" width=16 name=z1>
<img height=21 src="Cc.gif" width=9 name=cz1>
<img height=21 src="0c.gif" width=16 name=d1>
<img height=21 src="0c.gif" width=16 name=e1>
<img height=21 src="Cc.gif" width=9 name=f1>
<img height=21 src="0c.gif" width=16 name=g1>
<img height=21 src="0c.gif" width=16 name=h1>
</td></tr></table>
</center>

<div align="center">
<h4>(Days : Hours : Minutes : Seconds)</h4>
</div>

but when i start the page, it says row19sign1 (it's the brginning of c1), object doesn't support property or method.

Why or what did i wrong?

Hase
03-04-2003, 09:11 AM
It was very simple, but i was thinking about and looking around since 10am my time and it's like always: I didn't see the forest because of the much trees around ;))

jodeladijo