Perfetto...
a chi servisse (oppure per me se lo perdessi) ehehehe
codice:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Nuova pagina 1</title>
<script>
function controlla(obj) {
a = new Array(7,13,4,9)
t = a[obj.Tipo.selectedIndex];
n = obj.valore.value;
RE = /\D/
if (RE.test(n)) {
alert("solo numeri nel codice!")
return false
}
if (n.length!=t) {
alert("il codice deve essere di "+t+" cifre!")
return false
}
return true
}
</script>
</head>
<body>
<form method="POST" action="form.php" onsubmit="return controlla(this)">
<select size="1" name="Tipo">
<option>Tipo A</option>
<option>Tipo B</option>
<option>Tipo C</option>
</select>
<input type="text" name="valore" size="20">
<input type="submit" value="Invia" name="B1">
<input type="reset" value="Reimposta" name="B2">
</p>
</form>
</body>
</html>