creo que no estoy usando bien la función, puesto que no me arroja resultado del if sino solo del else y cuando trato de imprimir el lenght, me sale "undefined".
Código:
<html>
<head>
<title>Documento sin título</title>
<script language="javascript" type="text/javascript">
function valida(){
if(document.form1.texto.length<8){
alert(document.form1.texto.length);
return false;
}else{
alert(document.form1.texto.length);
return false
}
}
</script>
</head>
<body>
<form method="post" action="" name="form1">
<input type="text" / name="texto">
<input type="button" value="ver" onclick="valida()"/>
</form>
</body>
</html>