test again

dommy

New Member
Original Poster
<!-- Start: ligHTCC's Countdown Timer -->

<script language='JavaScript'> <!--
// You may use and distribute this script as you like.
//
// But unless you make major changes in the code I would prefer
// that you retained my email below as author.
//
// best jakob.aggernaes@get2net.dk

// Type in event and time below.
var event = "New Year 2001"
var eYear = 2001 // now +-27 years
var eMonth = 0 // 0..11 ( 0=january, 11=december )
var eDay = 1 // 1..31
var eHour = 00 // 0..23
var eMinute = 00 // 0..59
var eSecond = 00 // 0..59


var debugOn = false;
function debug(str) { if (debugOn==true) debugOn = confirm(str); };


function setTarget ( tid, year, month, day, hour, minute, second ) {
this.tEvent = tid; // string
this.tYear = year; // range 1970..2037
this.tMonth = month; // range 0..11 (jan=0, dec=11)
this.tDay = day; // range 0..31
this.tHour = hour; // range 0..23
this.tMinute = minute; // range 0..59
this.tSecond = second; // range 0..59
this.tDate = new Date( year, month, day, hour, minute, second );
this.t = Date.parse( this.tDate.toGMTString() );
debug ("setTarget: tSecond = " +this.tSecond);
return this;
}; // end setTarget( ... ) -> object

var target = new setTarget ( event, eYear, eMonth, eDay, eHour, eMinute, eSecond );

function setDelta() {
this.nDate = new Date();
this.n = Date.parse( this.nDate.toGMTString() );
this.dSecond = Math.round( ( target.t -this.n ) / 1000 );
debug ("setTarget: dSecond = " +this.dSecond);
if ( 0 > this.dSecond ) {
this.dSecond = -this.dSecond;
this.d = 1;
} else {
this.d = -1;
};
this.dMinute = Math.floor( this.dSecond/60 );
this.dSecond = this.dSecond -(this.dMinute * 60)
this.dHour = Math.floor( this.dMinute/60 );
this.dMinute = this.dMinute -(this.dHour * 60)
this.dDay = Math.floor( this.dHour/24 );
this.dHour = this.dHour -(this.dDay * 24);
return this;
}; // end setTarget( ... ) -> object

var delta = new setDelta ();

var digits = new Array( "0", "1", "2", "3",
"4", "5", "6", "7", "8", "9", "none" );
for (i=0; digits.length>i; i++) {
digits = "pics/ciffer"+digits+".gif";
};

var imgOff = -1; // index of document.images["c0"];
var charTab = "0123456789 "; // de anvendte billeder

function showVal ( val, size, offset ) {
var i = 0;
if (0 > imgOff) {
for (i=0; (document.images.length>i) && (0>imgOff); i++) {
if (document.images==document.images.c0) {
imgOff = i;
}; //endif
}; //endfor
if (0 > imgOff ) {
debug( "showVal: imgOff value not found" );
} else { debug( "showVal: imgOff = " +imgOff );
}; //endif
}; //endif
var txVal = ": "+val;
txVal = txVal.substring(txVal.length-size);
for (i=0; txVal.length>i; i++) {
document.images[i+offset+imgOff].src =
digits[ charTab.indexOf( txVal.substring(i,i+1) ) ]
}; //endfor
}; //end showVal ( number, length, offset )

var updateHand = setTimeout("showTimeLeft()",1000);

function showTimeLeft() {
updateHand = setTimeout("showTimeLeft()",990);
//note: ms parameter fudged a bit to compensate for time betveen calls
var increment = delta.d;
delta.dSecond += increment;
if ( (0 > delta.dSecond)
||(delta.dSecond >59) ) {
delta = new setDelta();
if (delta.d != increment) window.location.reload();
};
showVal( delta.dDay, 4, 0 );
showVal( delta.dHour, 2, 4 );
showVal( delta.dMinute, 2, 6 );
showVal( delta.dSecond, 2, 8 );
}; //end showTimeLeft()


// --> </script>

<p>
<center><FONT SIZE="+1"><nobr>&nbsp;
<img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle' name="c0"><img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'><img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'><img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'>
days &nbsp;
<img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'><img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'>
hours&nbsp;</nobr>
<nobr>&nbsp;
<img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'><img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'>
minutes &nbsp; and
<img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'><img src="pics/ciffernone.gif" width=33 height=40 align='absmiddle'>
seconds</nobr> <br>
<script language='javascript'>
document.write( (delta.d>0)?"after ":"until " +target.tEvent );
</script>
</FONT></center>

<!-- End: ligHTCC's Coubtdown Timer -->
 

Register on WDWMAGIC. This sidebar will go away, and you'll see fewer ads.

Back
Top Bottom