Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Metodo para validar el formulario usuario
- function validarUsuario() {
- //Asignamos los datos del formulario a las variables
- var rut = document.getElementById("txtRut").value;
- var nombre = document.getElementById("txtNombre").value;
- var apellido = document.getElementById("txtApellido").value;
- var edad = document.getElementById("txtEdad").value;
- var telefono = document.getElementById("txtTelefono").value;
- var pass = document.getElementById("txtPass").value;
- var pas2 = document.getElementById("txtPass2").value;
- //var aux = /\w+@+\w+.[a-z]/;
- //Validaciones
- if ( rut.length == 0 ) {
- alert("El Rut esta vacio!");
- } else if ( nombre.length == 0 ) {
- alert("El Nombre esta vacio!");
- } else if ( apellido.length == 0 ) {
- alert("El Apellido esta vacio!");
- } else if ( isNaN(edad) ) {
- alert("La edad no es correcta!");
- } else if ( telefono.length == 0 ) {
- alert("El Telefono esta vacio!");
- } else if ( pass.length == 0 ) {
- alert("La contraseña esta vacia!");
- } else if ( pas2.length == 0 ) {
- alert("La contraseña2 esta vacia!");
- }
- }
- function validandoLogin() {
- var user = document.getElementById("txtUser").value;
- var pass = document.getElementById("txtPass").value;
- if ( user.trim() == "Duoc" && pass.trim() == "1234" ) {
- document.write("<h3 style='text-align:center;'>Usuario: " + user + "</h3>");
- document.write("<h3 style='text-align:center;'>Contraseña: " + pass + "</h3>");
- location.href="formulario.html";
- return true;
- } else {
- alert("Usuario o contraseña incorrectos!");
- return false;
- }
- }
Add Comment
Please, Sign In to add comment