Ciao a tutti
Volevo creare una pagina HTML in cui inserire un 'input type="text"' su cui viene visualizzata la data e l'ora in modo preciso...
Ho steso questo codice ma non mi scrive niente![]()
Qualcuno sa dirmi dove sbaglio?codice:<!DOCTYPE html> <head> <title>Data</title> <script> function data() { var wday = getDay(); var day = getDate(); var month = getMonth(); var year = getYear(); var hours = getHours(); var minutes = getMinutes(); var seconds = getSeconds(); var milliseconds = getMilliseconds(); if(wday==1) { wday = "Lunedì"; } if(wday==2) { wday = "Martedì"; } if(wday==3) { wday = "Mercoledì"; } if(wday==4) { wday = "Giovedì"; } if(wday==5) { wday = "Venerdì"; } if(wday==6) { wday = "Sabato"; } if(wday==7) { wday = "Domenica"; } if(month==0) { month = "Gennaio"; } if(month==1) { month = "Febbraio"; } if(month==2) { month = "Marzo"; } if(month==3) { month = "Aprile"; } if(month==4) { month = "Maggio"; } if(month==5) { month = "Giugno"; } if(month==6) { month = "Luglio"; } if(month==7) { month = "Agosto"; } if(month==8) { month = "Settembre"; } if(month==9) { month = "Ottobre"; } if(month==10) { month = "Novembre"; } if(month==11) { month = "Dicembre"; } if(day<10) { day = "0"+day; } if(hours<10) { hours = "0"+hours; } if(minutes<10) { minutes = "0"+minutes; } if(seconds<10) { seconds = "0"+seconds; } if(milliseconds<10) { milliseconds = "0"+milliseconds; } document.formins.textins.value = (wday+" "+day+" "+month+" del "+year+", ore "+hours+" : "+minutes+" : "+seconds+" : "+milliseconds); } window.onload = data; </script> </head> <body> <form name="formins"> <input type="text" name="textins" value="" disabled="disabled"> </form> </body> </html>
Grazie![]()