Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions 1-syntax-basic-constructs/basic-js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>

</head>
<body>


<script src="basic.js"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions 1-syntax-basic-constructs/basic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const edad = prompt ('Ingrese su edad:')
function mayorEdad(edad) {
if (edad > 18 ){
alert('mayor edad')
}else {
alert('Es menor de edad')
}
}
mayorEdad(edad)
51 changes: 51 additions & 0 deletions 2-dom-manipulation/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Formulario de validación</title>
</head>
<body>

<form action="" id="form">
<label for="name">Nombre</label>
<input type="text" id="myname" name="user_name" placeholder="Mayra" >
<label for="apellidp">Apellido</label>
<input type="text" id="apellido" name="lastname" > <br>
<label for="mail">Correo Electrónico</label>
<input type="email" id="email-form" name="user_mail" >
<label for="date"> fecha</label>
<input type="date" id="date" name="trip-start"
value="2018-07-22"
min="2018-01-01" max="2022-12-31" ><br>
<input type="radio" name="sexo" value="Mujer"> Mujer
<input type="radio" name="sexo" value="Hombre"> Hombre <br>

<h2>Estrato</h2>
<select name="estrato" id="estrato">
<option value="">Escoger</option>
<option value="Estrato 1">Uno</option>
<option value="Estrato 2">Dos</option>
<option value="Estrato 3">Tres</option>
<option value="Estrato 4">Cuatro</option>
</select>

<h2>Hobbis</h2>
<label for="cbox1">Ciclismo</label>
<input type="checkbox" id="cbox1" name="chek" value="Ciclismo" ><br>
<label for="cbox2">Patinaje</label>
<input type="checkbox" id="cbox2" name="chek" value="Patinaje" ><br>
<label for="cbox3">Gym</label>
<input type="checkbox" id="cbox3" name="chek" value="Gym" ><br>
<label for="cbox4">Baloncesto</label>
<input type="checkbox" id="cbox4" name="chek" value="Baloncesto" ><br>
<label for="imagen"></label>
<input type="file" id="imagen" name="imagen" type="POST" enctype="multipart/formdata" >
<button>Enviar</button>
</form>

<script src="form.js"></script>

</body>
</html>
46 changes: 46 additions & 0 deletions 2-dom-manipulation/form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
function validaTeForm(event){
event.preventDefault();
console.log('Datos Ingresados');

const name = document.querySelector('#myname')

const mail = document.querySelector('#email-form').value
console.log(mail)

const genero = document.querySelector('input[name="sexo"]:checked');
if(genero) {
alert(genero.value);
} else {
alert('No hay ninún elemento activo');
}

const hobbys = document.querySelector('input[name="chek"]:checked');
if(hobbys) {
alert(hobbys.value);
} else {
alert('Seleccione su Hobby');
}

const select = document.querySelector('#estrato');
let valueselect = select.value;
console.log(valueselect);

if (name.value === "" ) {
alert('El campo es requerido')
}

}

const form = document.querySelector('form');
form.addEventListener('submit', validaTeForm);