Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="es">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>5.5-6</title>
- <style>
- form{
- text-align: center;
- }
- fieldset{
- margin: 1em;
- padding: 1em;
- }
- label{
- color:red;
- }
- </style>
- </head>
- <body>
- <form>
- <fieldset>
- <legend>Credenciales</legend>
- Nombre <input type="text" id="nombre"> <br>
- <label id="nomErr"></label> <br><br>
- Contraseña <input type="password" id="contraseña">
- <label id="passErr"></label> <br><br>
- </fieldset>
- <fieldset>
- <legend>Colores Favoritos</legend>
- <input type="checkbox" id="rojo">Rojo
- <input type="checkbox" id="azul">Azul
- <input type="checkbox" id="verde">Verde
- <input type="checkbox" id="morado">Morado
- <input type="checkbox" id="violeta">Violeta
- <input type="checkbox" id="amarillo">Amarillo
- <input type="checkbox" id="rosa">Rosa
- <input type="checkbox" id="gris">Gris
- <label id="coloresErr"></label> <br><br>
- </fieldset>
- <fieldset>
- <legend>Género</legend>
- <input type="radio" name="gen" id="Hombre">Hombre
- <input type="radio" name="gen" id="Mujer">Mujer
- <label id="generoErr"></label> <br><br>
- </fieldset>
- <fieldset>
- <legend>Introduce la ruta del fichero</legend>
- Fichero adjunto <input type="file" id="adjunto">
- <label id="adjuntoErr"></label> <br><br>
- </fieldset>
- <button id="validar">Valida</button>
- <button id="addCook">Escribe Cookies</button>
- <button id="showAllCook">Muestra Cookies</button>
- <button id="delCook">Borra Cookies</button>
- <button id="showCook">Consulta una cookie</button>
- <input type="reset" value="Borra información">
- </form>
- </body>
- <script type="application/javascript">
- document.getElementById("validar").addEventListener("click",validar);
- document.getElementById("addCook").addEventListener("click",addCook);
- document.getElementById("showAllCook").addEventListener("click",showAllCook);
- document.getElementById("delCook").addEventListener("click",delCook);
- document.getElementById("showCook").addEventListener("click",showCook);
- var nomErr = document.getElementById("nomErr");
- function validar() { //validar all form with ExpReg Mostrar mensajes de Error
- // NOMBRE
- var nom = document.getElementById("nombre");
- var nomVal = false;
- let ExpRNom = /[a-zA-Z]{4}/; //condición minima a cumplir TRUE si >4 letras??
- ExpRNom.test(nom.value) ? nomVal = true : nomVal = false
- debugger;
- nomVal ? nomErr.innerText = '' : nomErr.innerText = 'Tiene que tener mínimo 4 letras!'
- var pass = document.getElementById("contraseña");
- var passErr = document.getElementById("passErr");
- var coloresErr = document.getElementById("coloresErr");
- var genero = document.getElementById("gen");
- var genErr = document.getElementById("generoErr");
- var archivo = document.getElementById("adjunto");
- var adjuntoErr = document.getElementById("adjuntoErr");
- }
- function addCook(params) { //crear cookie
- }
- function showAllCook(params) { //Alert
- }
- function delCook(params) {
- }
- function showCook(params) { //buscar por nombre INPUT => Alert
- }
- </script>
- </html>
- <!--nombre: Min 4 letras
- pass: Mayus, Minus, nums(1 de cada min)
- checkbox: minimo select 4
- genero: REQUIRED
- file: REQUIED
- -- -- -- -- -- -- -- -- -- -- -- --
- Al borrar todas cookies(cookies = 0), MOSTRAR COOKIES => Alert: No hay cookies
- -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement