[ubuntu-it-www] Re: contatore

Fabio Marzocca thesaltydog at gmail.com
Fri Mar 28 16:41:03 GMT 2008


2008/3/28 Remo Quintino <remo.quintino at alice.it>:
>  Fatto, :)
>  Ah, l'immagine e' quasi pronta, occorrerebbe recuperare il codice per
>  il contatore che abbiamo usato per gutsy.
>  Fabio, lo puoi cercare? :)


<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--//start

numbers = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");

function isShort(str){
   if (str in numbers) return true;
   return false;
}

dateFuture = new Date(2007,9,18,00,00,00);

//document.write(dateFuture +"<br />");

function GetCount(){

	dateNow = new Date();								
	amount = dateFuture.getTime() - dateNow.getTime();		
	delete dateNow;

	if(amount < 0){
		document.getElementById('countbox').innerHTML="Now!";
	}
	else{
		days=0;hours=0;mins=0;secs=0;out="";

		amount = Math.floor(amount/1000);

		days=Math.floor(amount/86400);
		amount=amount%86400;

		hours=Math.floor(amount/3600);
		amount=amount%3600;

		mins=Math.floor(amount/60);
		amount=amount%60;

		secs=Math.floor(amount);

                if (isShort(days)) days = "&nbsp;" + days;
                if (isShort(hours)) hours = "0" + hours;
                if (isShort(mins)) mins = "0" + mins;
                if (isShort(secs)) secs = "0" + secs;

                out += '<table style="border: none; width: 140px;
height: 20px;" cellpadding="0" cellspacing="0"><tr style="text-align:
center"><td style="width: 30px">' + days + '</td><td style="width:
40px;">' + hours + '</td><td style="width: 40px">' + mins + '</td><td
width="width: 25px">' + secs + '</td></tr></table>';

		document.getElementById('countbox').innerHTML=out;

		setTimeout("GetCount()", 1000);
	}
}

window.onload=function(){GetCount();}

//-->
</script>



More information about the Gruppo-web mailing list