-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tarea 2 terminada. Se requirio: un formmulario que capture el primern ombre, segundo nombre, apellido y edad del usuario. Tras ser completado, el h1 debería modificarse para incluir el nombre del usuario y su información debería mostrarse en un campo
- Loading branch information
Showing
3 changed files
with
338 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
body { | ||
text-align: center; | ||
background-image: url(https://images.unsplash.com/photo-1473093295043-cdd812d0e601?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1750&q=270) | ||
} | ||
|
||
.box{ | ||
position: relative; | ||
display: inline-block; | ||
width: 562px; | ||
} | ||
|
||
.box .text{ | ||
position: absolute; | ||
z-index: 999; | ||
margin: 0 auto; | ||
left: 0; | ||
right: 0; | ||
top: 18%; | ||
text-align: center; | ||
width: 80%; | ||
} | ||
|
||
h1 { | ||
font-size: 50px; | ||
font-family:Georgia, 'Times New Roman', Times, serif; | ||
color: #c63202; | ||
box-shadow: white; | ||
text-shadow: 0 0 6px #fff; | ||
margin-top: 8%; | ||
|
||
} | ||
h3 { | ||
text-align: center; | ||
font-size: 20px; | ||
font-family:Georgia, 'Times New Roman', Times, serif; | ||
font-weight: bold; | ||
} | ||
form { | ||
text-align: left; | ||
display: inline-block; | ||
font-family:Arial, Helvetica, sans-serif; | ||
width: 500px; | ||
height: 320px; | ||
background-color: rgba(185, 250, 124, 0.838); | ||
padding: 20px; | ||
border-radius: 8px; | ||
} | ||
|
||
label{ | ||
font-family: Georgia, 'Times New Roman', Times, serif; | ||
font-size: 18px; | ||
text-align:left; | ||
font-weight: bold; | ||
} | ||
|
||
input, | ||
textarea{ | ||
font-family: Georgia, 'Times New Roman', Times, serif; | ||
font-size: 18px; | ||
border-radius: 4px; | ||
width: 150px; | ||
height: 22px; | ||
box-sizing: border-box; | ||
border: 1px solid #999; | ||
margin-left: 30px; | ||
padding-left: 10px; | ||
} | ||
|
||
input#email { | ||
width: 300px; | ||
} | ||
|
||
#join-button { | ||
font-family: Georgia, 'Times New Roman', Times, serif; | ||
font-size: 20px; | ||
background-color: rgba(185, 250, 124, 0.838); | ||
border: none; | ||
border-radius: 8px; | ||
width: 70px; | ||
height: 30px; | ||
border: 2px solid white; | ||
transition-duration: 0.2s; | ||
margin-left: 215px; | ||
} | ||
|
||
|
||
#join-button:hover { | ||
font-weight: bold; | ||
width: 75px; | ||
height: 35px; | ||
|
||
} | ||
|
||
#two { | ||
background-color: white; | ||
} | ||
|
||
#reveal-text{ | ||
display: none; | ||
} | ||
#welcome-text{ | ||
vertical-align: middle; | ||
font-size: 20px; | ||
font-family: Georgia, 'Times New Roman', Times, serif; | ||
margin-top: 85px; | ||
|
||
} | ||
#under-18{ | ||
display: none; | ||
} | ||
|
||
#text-under-18{ | ||
vertical-align: middle; | ||
font-size: 20px; | ||
font-family: Georgia, 'Times New Roman', Times, serif; | ||
margin-top: 110px; | ||
} | ||
|
||
table { | ||
background-color:rgb(239, 226, 210, 0.838); | ||
margin-top: 30px; | ||
width: 550px; | ||
height: 320px; | ||
padding: 20px; | ||
border-radius: 8px; | ||
text-align: center; | ||
} | ||
th { | ||
font-family: Georgia, 'Times New Roman', Times, serif; | ||
font-size: 20px; | ||
margin-top: 50px; | ||
padding-bottom: 20px; | ||
} | ||
td { | ||
padding: 10px; | ||
} | ||
td, | ||
img { | ||
border-radius: 6px; | ||
} | ||
|
||
.member-img { | ||
transition-duration: 0.2s; | ||
} | ||
|
||
.member-img:hover { | ||
opacity: 0.500; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<!doctype html> | ||
<html lang="es"> | ||
<head> | ||
<link rel="stylesheet" href="css/styles.css" /> | ||
</head> | ||
<script type="javascript" src='pasta.js'> </script> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" | ||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>The Pasta Club</title> | ||
</head> | ||
<body> | ||
<div class="box"> | ||
<img src="https://i.imgur.com/fj0UM7H.png" alt="Frame"> | ||
<div class="text"><h1 id="pasta-header">Welcome to <br>the Pasta Club!</h1></div></div> | ||
<br><br> | ||
<div id= "form-hide" align="center"><form> | ||
<h3>Please fill in the form if you'd like to join:</h3> | ||
<br> | ||
<label for="name">Name: </label> | ||
<input type="text" id="name" name="username" required="required"> | ||
<br><br> | ||
<label for="second_name">Second name: </label> | ||
<input type="text" id="second_name" name="second_username" required="required"> | ||
<br><br> | ||
<label for="surname">Surname: </label> | ||
<input type="text" id="surname" name="user_surname" required="required"> | ||
<br><br> | ||
<label for="age">Age: </label> | ||
<input type="number" id="age" name="user_age" required="required"> | ||
<br><br> | ||
<label for="email">E-mail: </label> | ||
<input type="email" id="email" name="user_mail" required="required"> | ||
<br><br> | ||
<button type="submit" id="join-button">Join</button> | ||
</form> | ||
</div> | ||
<div id= "reveal-text" align="center"><form> | ||
<div id= "welcome-text" align="center">Hey there, <p class="paragraph" id="usernameText"></p> <p class="paragraph" id="userSecondNameText"></p> <p class="paragraph" id="userSurnameText"></p>! | ||
We are pleased to announce you are now a member of our club! We will log you in with an assigned username: <b><p class="paragraph" id="assignedUsernameText"></p>-<p class="paragraph" id="userAgeText"></p></b> | ||
<br>You may change your username and password only after verifying your e-mail address. An e-mail with a secret link should be waiting for you in your inbox! | ||
</div> | ||
</form> | ||
<table> | ||
<tr> | ||
<th colspan="4">Meanwhile, you can take a peek at what our wonderful members are doing...</th> | ||
</tr> | ||
<tr> | ||
<td> | ||
<a href="https://prettypasta.tumblr.com/post/176134492061/summer-squash-vegan-mac-n-cheese-with-herb-pesto"> | ||
<img class = "member-img" alt="summer-squash-vegan-mac-n-cheese-with-herb-pesto" src="https://66.media.tumblr.com/7f44f9295b9a36e2d7ddbd903dbaf456/tumblr_ov2iqlYiOT1r29uexo1_500.jpg" | ||
width=90" height="140"> | ||
</a> | ||
</td> | ||
<td> | ||
<a href="https://prettypasta.tumblr.com/post/174954365954/simplest-zucchini-parmesan-pasta"> | ||
<img class = "member-img" alt="simplest-zucchini-parmesan-pasta" src="https://66.media.tumblr.com/9f02d6439fb6cc26a4773fed71dae5f2/tumblr_pacopr0J3v1r29uexo1_500.jpg" | ||
width=90" height="140"> | ||
</a> | ||
</td> | ||
<td> | ||
<a href="https://prettypasta.tumblr.com/post/174924064415/the-best-weeknight-pasta-sauce"> | ||
<img class = "member-img" alt="the-best-weeknight-pasta-sauce" src="https://66.media.tumblr.com/bef7f2ebeb6d28bcd382809e920d2e49/tumblr_pa2o5aJLMO1r29uexo1_500.jpg" | ||
width=90" height="140"> | ||
</a> | ||
</td> | ||
<td> | ||
<a href="https://prettypasta.tumblr.com/post/174640057332/stovetop-mac-and-cheese"> | ||
<img class = "member-img" alt="stovetop-mac-and-cheese" src="https://66.media.tumblr.com/10176abd9b5e0c667651f9b5fdf01693/tumblr_p8l030YkuE1r29uexo1_500.jpg" | ||
width=90" height="140"> | ||
</a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<a href="https://prettypasta.tumblr.com/post/174445219959/arrabiata-pasta-with-shrimp"> | ||
<img class = "member-img" alt="arrabiata-pasta-with-shrimp" src="https://66.media.tumblr.com/4a1a71d0a74febdfba2f69822ecae733/tumblr_p8na7hoGKU1r29uexo1_500.jpg" | ||
width=90" height="140"> | ||
</a> | ||
</td> | ||
<td> | ||
<a href="https://prettypasta.tumblr.com/post/174608025698/cashew-pesto-pasta"> | ||
<img class = "member-img" alt="cashew-pesto-pasta" src="https://66.media.tumblr.com/109ea49d8d3467e7e661e2fb9bb3b01a/tumblr_p6yf6mUcNn1r29uexo1_500.jpg" | ||
width=90" height="140"> | ||
</a> | ||
</td> | ||
<td> | ||
<a href="https://prettypasta.tumblr.com/post/174188741453/garlic-herb-spaghetti-with-baked-chicken-meatballs"> | ||
<img class = "member-img" alt="garlic-herb-spaghetti-with-baked-chicken-meatballs" src="https://66.media.tumblr.com/6870ee9c935ddada4a6f5c403becb167/tumblr_p8chmrSPVp1r29uexo1_500.jpg" | ||
width=90" height="140"> | ||
</a> | ||
</td> | ||
<td> | ||
<a href="https://prettypasta.tumblr.com/post/173648605934/fusilli-alfredo-with-mushrooms"> | ||
<img class = "member-img" alt="fusilli-alfredo-with-mushrooms" src="https://66.media.tumblr.com/106485a6ed403cc178991d3fa9400e14/tumblr_otj8tm0QIC1r29uexo1_500.jpg" | ||
width=90" height="140"> | ||
</a> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
<div id="under-18" align="center"><form><div id="text-under-18" align="center">You are <b>under 18</b>, thus, you are not allowed to join. Thank you so much for your interest.<br> | ||
You might want to check out our Kids Pasta Club! Where fun is what counts</div></form></div> | ||
|
||
|
||
|
||
|
||
<script src="pasta.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// SEGUNDA TAREA | ||
//TAREA: En otro archivo html (no Index) y otro archivo js (no tarea-clase-5.js), | ||
// creá un formulario que capture el primer nombre, segundo nombre, apellido/s y edad del usuario | ||
// también vamos a crear un <h1> que diga Bienvenido! | ||
// vas a crear un botón de acción que una vez que lo apretás, va a | ||
// mostrar toda la información junta en un campo de texto | ||
// Y va a cambiar el <h1> para decir "Bienvenido, nombreDeUsuario"! | ||
/* | ||
const $botonCalcular = document.querySelector("#boton-calcular"); | ||
$botonCalcular.onclick = function() { | ||
const salarioAnual = Number(document.querySelector("#salarioanual").value); | ||
const salarioMensual = salarioAnual / 12 | ||
console.log(salarioMensual) | ||
document.getElementById("salario-mensual").value = salarioMensual; | ||
// document.getElementById("salario-mensual").innerHTML = salarioMensual; | ||
return false; | ||
} | ||
*/ | ||
|
||
|
||
|
||
function getInputIntoText() { | ||
userName = document.getElementById('name').value; | ||
const userSecondName = document.getElementById('second_name').value; | ||
const userSurname = document.getElementById('surname').value; | ||
const userAge = Number(document.getElementById('age').value); | ||
document.getElementById('usernameText').replaceWith(userName) | ||
document.getElementById('userSecondNameText').replaceWith(userSecondName) | ||
document.getElementById('userSurnameText').replaceWith(userSurname) | ||
document.getElementById('userAgeText').replaceWith(userAge) | ||
document.getElementById('assignedUsernameText').replaceWith(userName) | ||
}; | ||
|
||
var userName; | ||
const $joinButton = document.querySelector("#join-button"); | ||
|
||
$joinButton.onclick = function() { | ||
|
||
getInputIntoText(); | ||
if (Number(document.getElementById('age').value) > 18){ | ||
// get the element | ||
var div1 = document.getElementById('form-hide'); | ||
|
||
// set an event listener for it | ||
div1.addEventListener('click',function(){ | ||
|
||
this.parentNode.removeChild(this); | ||
|
||
document.querySelector("#reveal-text").style.display = "block"; | ||
|
||
const newPastaHeader = `Welcome to <br>the Pasta Club, ${userName}!` | ||
document.getElementById('pasta-header').innerHTML = newPastaHeader | ||
document.querySelector("h1").style.marginTop = "3%"; | ||
}); | ||
|
||
} | ||
else{ | ||
var div1 = document.getElementById('form-hide'); | ||
|
||
// set an event listener for it | ||
div1.addEventListener('click',function(){ | ||
|
||
this.parentNode.removeChild(this); | ||
|
||
document.querySelector("#under-18").style.display = "block"; | ||
|
||
const newPastaHeader = `We are sorry...` | ||
document.getElementById('pasta-header').innerHTML = newPastaHeader | ||
document.querySelector("h1").style.marginTop = "15%"; | ||
}); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} |