|
24 | 24 | /** |
25 | 25 | * PRUEBAS JSON |
26 | 26 | */ |
27 | | - /* if (nom!=null && ape!=null && mai!=null && usu!=null && pas!= null){ */ |
| 27 | + if (!nom || !ape || !mai || !usu || !pas) { |
| 28 | + |
| 29 | + //Envia mensaje a <DIV> con ID "mensajeLogin" en el documento |
| 30 | + document.querySelector('#mensajeRegistro').innerText = "Falta ingresar algun dato."; |
| 31 | + |
| 32 | + }else{ |
28 | 33 | // Obtener los datos existentes en localStorage (si existen) |
29 | 34 | let usuarios = JSON.parse(localStorage.getItem('usuarios')) || []; |
30 | 35 |
|
|
43 | 48 |
|
44 | 49 | //Envia mensaje a DIV con ID "mensajeRegistro" en el documento |
45 | 50 | document.querySelector('#SetPassword').innerText = "Usuario y password REGISTRADO"; |
46 | | - /* } else { |
47 | | - return NaN; |
48 | | - } */ |
49 | | - |
| 51 | + } |
50 | 52 |
|
51 | 53 | return registroUsuarios; |
52 | 54 | } |
|
58 | 60 | function mostrarLogin() { |
59 | 61 | let docuLogin = document.getElementById('contenido'); |
60 | 62 | document.getElementById('contenido').innerHTML =` |
61 | | - <div id="formlogin"><img src="./img/logo.jpg" alt="Logo"> |
| 63 | + <div id="formlogin"><img src="/img/logo.jpg" alt="Logo"> |
62 | 64 | <BR><h2>Iniciar Sesión</h2> |
63 | 65 | <form class="formSubmit" action="#"> |
64 | 66 | <input type="text" id="GetUsuario" placeholder="Usuario" required> |
|
86 | 88 | let docuRegister= document.getElementById('contenido'); |
87 | 89 | event.preventDefault() |
88 | 90 | document.getElementById('contenido').innerHTML = ` |
89 | | - <div id="formlogin"><img src="./img/logo.jpg" alt="Logo"> |
| 91 | + <div id="formlogin"><img src="/img/logo.jpg" alt="Logo"> |
90 | 92 | <h2>Crea tu cuenta</h2> |
91 | 93 | <form class="formSubmit" action="#"> |
92 | 94 | <input type="text" id="SetNombre" placeholder="Nombre" required> |
93 | 95 | <input type="text" id="SetApellido" placeholder="Apellido" required> |
94 | 96 | <input type="email" id="SetMail" placeholder="Correo Electronico" required> |
95 | 97 | <input type="text" id="SetUsuario" placeholder="Usuario" required> |
96 | 98 | <input type="password" id="SetPassword" placeholder="Contraseña" required> |
97 | | - <input type="submit" id="register" value="Registrarse" onclick="registro()" ><BR> |
| 99 | + <input type="submit" id="register" value="Registrarse" onclick="registro()" > |
| 100 | + <div id="mensajeRegistro"><BR></div> |
98 | 101 | </form> |
99 | | - Ya tienes usuario? <button id="login" class="btnLogin" onclick="mostrarLogin()">Login</button> |
| 102 | + <BR>Ya tienes usuario? <button id="login" class="btnLogin" onclick="mostrarLogin()">Login</button> |
100 | 103 | </div> |
101 | 104 | `; |
102 | 105 |
|
|
0 commit comments