esempio semplice:
codice:
<html> <head>
<script type="text/javascript">
function numero(evt) {
if(Che-controlla-il-campo){
document.getElementById("errore_codice").style.display='block';
}else{
document.getElementById("errore_codice").style.display='none';
}
}
</script>
</head>
<body>
<form action='prova.php' method="GET">
<input type="text" name="codice" onkeypress="return numero(event);">
<span id="errore_codice" style="display:none">errore hai inserito delle lettere</span>
<input type="submit">
</form>
</body>
</html>