• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

create a countdown clock

ElementalDragon

The One and Only
#1
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.
 

SPeedY_B

I may actually be insane.
#2
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.
 

SPeedY_B

I may actually be insane.
#5
I have absolutely no idea how the monkey Samurize works. If it's HTML based, is there no way of importing that code/file ?
 

Members online

No members online now.

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,014
Latest member
sanoravies