create a countdown clock

ElementalDragon

The One and Only
Joined
8 Aug 2002
Messages
3,159
anyone know how to create a countdown clock in Samurize or something else that can be seen right on the desktop? kinda want one so i know when HL2 is out. there's one on planethalflife.com near the picture of the day if you wanna see it.
 
Easiest way to do it, yoink their code.

Timer: link
Code:
Code:
<script>
var timerID = null;
var timerRunning = false;

function startClock() {
	stopClock();
	timeRemaining();
}

function stopClock() {
	if (timerRunning)
	clearTimeout(timerID);
	timerRunning = false;
}

function timeRemaining() {
	var now = new Date();                                
	var then = new Date(2004, 10, 15, 23, 59, 59);  
	var yearsLeft; var daysLeft; var hoursLeft; var minsLeft; var secsLeft;
	secsLeft = Math.round(then.getTime() - (now.getTime() + 1000)) / 1000;
	daysLeft = Math.floor(secsLeft / 86400);  
	secsLeft %= 86400;
	hoursLeft = Math.floor(secsLeft / 3600);      
	secsLeft %= 3600;
	minsLeft = Math.floor(secsLeft / 60);         
	secsLeft %= 60;
	secsLeft = Math.round(secsLeft);
	
	if (secsLeft == 60) {
		secsLeft = 0;
		minsLeft = minsLeft++;
	}
	
	if (minsLeft == 60) {
		minsLeft = 0;
		hoursLeft = hoursLeft++;
	}
	
	if (hoursLeft == 24) {
		hoursLeft = 0;
		daysLeft = dayssLeft++;
	}
	
	document.doomsday.total.value = (daysLeft + " days, " + hoursLeft + " hrs, " + minsLeft + " min, " +  secsLeft + " sec");
	
	timerID = setTimeout("timeRemaining()", 1000);
	timerRunning = true;
}

window.onload=startClock;

</script>

<form name="doomsday">Time Remaining:&nbsp;<input readonly="true" type="text" name="total" size="27" style="border: 0px; background-color: #EAEAEA; font-size: 8pt;"></form>
then add it as an active desktop item.
 
I have a similar idea for Halo 2, don't know if I'll ever get around to actually doing it though :p
 
speedy, any way you could add that to an active script file so i could use it wit Samurize?
 
I have absolutely no idea how the monkey Samurize works. If it's HTML based, is there no way of importing that code/file ?
 
your guess is good as mine. lol. i didn't do that much of my own configuring. just needs to be a working .vbs file i think.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back