Salve.
Utilizzo il seguente JS per visualizzare un orologio su pagina html.
codice:
<script type="text/javascript">
function updateClock2 ( ){
var currentTime = new Date();
var currentDay = currentTime.getDate();
var currentYear = currentTime.getYear();
var currentHours = currentTime.getHours();
var currentMinutes = currentTime.getMinutes();
var currentSeconds = currentTime.getSeconds();
// Pad the months with real value (function getmonth return values from 0 to 11)
var month=new Array();
month[0]="01";
month[1]="02";
month[2]="03";
month[3]="04";
month[4]="05";
month[5]="06";
month[6]="07";
month[7]="08";
month[8]="09";
month[9]="10";
month[10]="11";
month[11]="12";
var currentMonth = month[currentTime.getMonth()];
// Pad the day, hours, minutes and seconds with leading zeros, if required
currentDay = ( currentDay < 10 ? "0" : "" ) + currentDay;
currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
// Compose the string for display
var currentTimeString = currentYear + "." + currentMonth + "." + currentDay + " - " + currentHours + ":" + currentMinutes + ":" + currentSeconds
// Update the time display
document.getElementById("clock2").firstChild.nodeValue = currentTimeString;
}
// -->
</script>
C'è poi nel body una riga per aggiornare ogni secondo il valore dell'orologio:
codice:
<body onload="updateClock2(); setInterval('updateClock2()', 1000 )"></body>
In LocalHost di VWD 2008 nonché aprendo semplicemente la pagina salvata su pc, l'orologio è mostrato correttamente.
Quando vado a pubblicare la pagina su Aruba ottengo i seguenti risultati:
con Internet Explorer l'orologio non si vede.
con Mozzilla Firefox l'orologio non si vede
con Google Chrome si vede ma dà il seguente risultato: 113.02.18 00:20:53, cioè l'anno è 113 anziché 2013.
Quale mistero si cela dietro questo foglio?