Prova cosi:
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
function Psw(){
if(!document.form1.psw.value.match(/^[a-zA-Z0-9]+$/)){
alert("Ci sono caratteri non ammessi nel campo password");
document.form1.psw.focus();
return false;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento senza titolo</title>
</head>
<body>
<form name="form1" method="post" action="">
<input name="psw" type="text" id="psw" onBlur="return Psw()">
</form>
</body>
</html>
Il presente campo accetta solo caratteri alfanumerici.