Hola
hgp147
A ver si te sirve este ejemplo:
Código PHP:
<html>
<head>
<script type="text/javascript">
function validar(frm) {
if (frm.pepe.value.length < 4) {
document.getElementById('error').style.visibility = 'visible';
return false;
}
}
</script>
</head>
<body>
<form onsubmit="return validar(this)">
<input type="text" name="pepe" />
<p id="error" style="visibility:hidden">Longitud inválida</p>
<input type="submit" />
</form>
</body>
</html>
Saludos,