estimados tengo u problema con un codigo de html y javascript quien me podria ayudar para poder salir de este cachito. les dejo el codigo. <html> <head> <title>validador</title> <script type="text/javascript"> fonction validador{ mensage="recuerde: \n"; largoi=mensage.length; if(formulario.rut.value =="") { mensage=mensage + " - debe ingresar los primeros 8 dijitos del rut \n"; formulario.rut.focus(); } if(formulario.dv.valie =="") { mensage=mensage + "-ingrese el dijito verificador \n"; formulario.dv.focus(); } if(mensage.length > largoi) { alert8(""+mensage); return false; } } <script language="javascript"> function validarNro(e) { var key; if(window.event) // IE { key = e.keyCode; } else if(e.which) // Netscape/Firefox/Opera { key = e.which; } if (key < 48 || key > 57) { if( key == 8 ) // Detecta backspace (retroceso) o borrar { return true; } else alert ("solo se permiten numeros"); {return false;} } return true; } function validardijito(e) { var key; if(window.event) // IE { key = e.keyCode; } else if(e.which) // Netscape/Firefox/Opera { key = e.which; } if (key < 48 || key > 57) { if( key == 8 || key==75 || key==107 ) // Detecta backspace (retroceso) o borrar { return true; } else alert ("solo se permiten numeros o la letra k"); {return false;} } return true; } </script> </head> <body> <div id="rut" align="center"> <form action="rut.php" method="post" onsubmit="return validar(this)"> <h1>Este formulario es para validar el rut chileno </h1> <label style="font-size:24px;" >Ingrese Rut: </label> <input type="Text" size="8" maxlength="8" name="rut" onkeypress="javascript:return validarNro(event)"/> <input type="Text" size="1" maxlength="1" name="dv" onkeypress="javascript:return validardijito(event)"/> <input type="reset" value="Limpiar" /> <input type="submit" value="Comprobar"/> </form> </div> </body> </noscript> </html>
No se si ya lo reparaste pero bueno ahi esta!!! si analizas el fuente te daras cuenta que te faltaban algunas cosas y otras que estaban mal escritas!!! Recuerda que google siempre tiene la respuesta XD.
Bueno, quizás a esta altura ya tienes solucionado el asunto del RUT, pero dejo este dato en el caso que alguien busque también sobre el mismo problema. Yo recomiendo usar jQuery junto a esta librería: http://joaquinnunez.cl/jQueryRutPlugin/ es sumamente útil y completa. Solo basta mirar su documentación para ver lo versátil que es.