Hola niñas
Un ejemplito:
<Form Action="..." Method="post" id="MiForm" onSubmit="return Validame();">
<input name="nombre" type="text">
<input name="edad" type="text">
<input type="submit">
</form>
<script>
function Validame() {
return (ElNombre() && LaEdad());
}
function LaEdad() {
if (MiForm.edad.value == "" || !isFinite(MiForm.edad.value) || MiForm.edad.value < 0 || MiForm.edad.value > 144) {
alert ("Edad no válida");
MiForm.edad.focus();
return false;
}
else {
return true;
}
}
function ElNombre() {
if (MiForm.nombre.value != "") {
return true;
}
else {
alert("Ingrese su nombre");
MiForm.nombre.focus();
return false;
}
}
</script>
Nos vemos