Questo dovrebbe fare al caso tuo
codice:
<html>
<head>
<script type="text/javascript">
function controlla() {
len1 = document.getElementById('campo1').value.length;
len2 = document.getElementById('campo2').value.length;
if ((len1+len2) > 10) {
alert('campo 1 + campo 2 supera i 10 caratteri');
return false;
}
email = document.getElementById('email').value;
email = email.replace(/\s/, '');
if (email.match(/@libero.it$/)) {
alert('dominio non permesso');
return false;
}
return true;
}
</script>
</head>
<body>
<form action="pagina.php" method="post" onsubmit="return controlla()">
Campo1 <input type="text" id="campo1" name="campo1" />
Campo2 <input type="text" id="campo2" name="campo2" />
Email <input type="text" id="email" name="email" />
<input type="submit" value="invia" />
</form>
</body>
</html>
Ciauz