Certo!
Nel forum ho messo:
codice:
<input type="text" name="datanas" onblur="valid_eta()">
Poi come JS ho scritto:
codice:
// Verifica maggiorenne
function valid_eta(){
gg=document.example.datanas.value.substring(0,2)
mm=document.example.datanas.value.substring(3,5)
aa=document.example.datanas.value.substring(6,10)
dataconv=mm+"/"+gg+"/"+aa;
datanasc=new Date(dataconv)
oggi=new Date()
mesims=oggi.getTime() - datanasc.getTime()
anni=Math.floor((mesims / (1000 * 60 * 60 * 24 * 30.416)/12))
if(anni<1 || anni>90) {
alert("Non puoi avere "+anni+" anni!")
}
else {
alert("Hai "+anni+ " anni")
}
document.example.datanas.value=""
document.example.datanas.focus()
}
Ma al momento non fa neanche la verifica...