[code:1:13cf83d7ad]<form name="deathtoll">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="text">
<tr><td align="center"><input type="text" name="belltoll1" value="5,840,000,000" size="15" /><br />Nel mondo</td></tr>
<tr><td align="center"><input type="text" name="belltoll2" value="4.44/sec." size="15" /><br />Nascite dell'anno</td></tr>
<tr><td align="center"><input type="text" name="belltoll3" value="4.44/sec." size="15" /><br />Nascite oggi</td></tr>
<tr><td align="center"><input type="text" name="belltoll4" value="1.67/sec." size="15" /><br />Morti dell'anno</td></tr>
<tr><td align="center"><input type="text" name="belltoll5" value="1.67/sec." size="15" /><br />Morti oggi</td></tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
function popCount() {
doPop();
}
// incrementing
function string(number) {
var x;
x= Math.round(number)+" ";
x= x.substring(0,x.length-1);
if (x.length > 3) { x = x.substring(0,x.length-3) + "," + x.substring(x.length-3, 99); }
if (x.length > 7) { x = x.substring(0,x.length-7) + "," + x.substring(x.length-7, 99); }
if (x.length > 11) { x = x.substring(0,x.length-11) + "," + x.substring(x.length-11, 99); }
return x;
}
function doPop() {
var now = new Date();
var newyears = new Date("January 1, 2002");
var todaysdate = new Date("January 1, 2002");
var may4 = new Date("April 28, 2001");
var belltoll1;
var belltoll2;
var belltoll3;
var belltoll4;
var belltoll5;
newyears.setFullYear(now.getFullYear() );
secsSince = Math.round(now.getTime() - newyears.getTime())/1000;
secsSincePop = Math.round(now.getTime() - may4.getTime())/1000;
todaysdate.setMonth(now.getMonth()) ;;
todaysdate.setDate(now.getDate());
todaysdate.setFullYear(now.getFullYear( 1;);
secsToday = (now.getTime()-todaysdate.getTime())/1000;
belltoll1 = string(secsSincePop * 2.69 + 7028190022);
belltoll2 = string((secsSince) * 4.11);
belltoll3 = string((secsToday) * 4.11);
belltoll4 = string((secsSince) * 1.69);
belltoll5 = string((secsToday) * 1.69);
document.deathtoll.elements[0].value = belltoll1;
document.deathtoll.elements[1].value = belltoll2;
document.deathtoll.elements[2].value = belltoll3;
document.deathtoll.elements[3].value = belltoll4;
document.deathtoll.elements[4].value = belltoll5;
timerID = setTimeout("doPop()", 1);
timerRunning = true;
}
popCount()
// -->
</script>[/code:1:13cf83d7ad]
Come potete controllare i contatori aumentano seguendo una precisa sequenza.
Però ho notato che aggiornando la pagina si continua da dove si era rimasti, con qualche numero in più. Quindi i numeri fino al caricamento della pagina sono reali perchè provengono da qualche database.