-
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.
- Loading branch information
0 parents
commit 50f28da
Showing
11 changed files
with
144 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,53 @@ | ||
body{ | ||
background: rgb(28, 69, 218); | ||
font: normal 15pt Arial; | ||
} | ||
|
||
header{ | ||
color: white; | ||
text-align: center; | ||
} | ||
|
||
section{ | ||
background: rgb(21, 198, 77) ; | ||
border-radius: 10px; | ||
padding: 15px; | ||
width: 500px; | ||
margin: auto; | ||
box-shadow: 2px 2px 20px rgba(0, 0, 0, 0.674); | ||
} | ||
|
||
footer{ | ||
color: white; | ||
text-align: center; | ||
font-style: italic; | ||
padding: 15px; | ||
font-size: 14px; | ||
} | ||
div#cont{ | ||
text-align: center; | ||
} | ||
#btn{ | ||
background-color: rgb(251, 252, 251); | ||
border-radius: 10px; | ||
font-size: 19px; | ||
} | ||
#btn:hover{ | ||
background-color: rgb(47, 179, 20); | ||
color: white; | ||
} | ||
#txtano{ | ||
border-radius: 10px; | ||
text-shadow: none; | ||
} | ||
#cont p{ | ||
color: white; | ||
text-shadow: 1px 1px 6px black; | ||
font-size: 20px; | ||
} | ||
#res{ | ||
color: white; | ||
text-shadow: 2px 2px 6px black; | ||
text-align: center; | ||
font-size: 16px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,39 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-BR"> | ||
<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>Verificador de Idade</title> | ||
<link rel="stylesheet" href="estilo.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>Verificador de Idade</h1> | ||
</header> | ||
<section> | ||
<div id="cont"> | ||
<p>Digite o ano de Nascimento: | ||
<input class="Iano" type="number" name="txtano" id="txtano" min="0"> | ||
</p> | ||
<p>Selecione o sexo: | ||
<input type="radio" name="radsex" id="masc" checked> | ||
<label for="masc">Masculino</label> | ||
<input type="radio" name="radsex" id="fem"> | ||
<label for="fem">Feminino</label> | ||
</p> | ||
<p> | ||
<input id="btn" type="button" value="Verificar idade" onclick="verificar()"> | ||
</p> | ||
</div> | ||
<div id="res"> | ||
Por favor, preencha os dados acima para ver o resultado! | ||
</div> | ||
</section> | ||
<footer> | ||
<p>© CursoemVideo</p> | ||
<p>Desenvolvido por RickReis</p> | ||
</footer> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,52 @@ | ||
function verificar(){ | ||
var data = new Date() | ||
var ano = data.getFullYear() | ||
var fano = document.getElementById('txtano') | ||
var res = document.querySelector('div#res') | ||
|
||
if(fano.value.length == 0 || fano.value > ano){ | ||
window.alert('{ERRO} Verifique os dados e tente novamente!') | ||
}else{ | ||
var fsex = document.getElementsByName('radsex') | ||
var idade = ano - fano.value | ||
var genero ='' | ||
var img = document.createElement('img') | ||
img.setAttribute('id', 'foto') | ||
|
||
if(fsex[0].checked){ | ||
genero='Homem' | ||
if(idade >=0 && idade <10){ | ||
//criança | ||
img.setAttribute('src', 'hBaby.png') | ||
}else if(idade < 21){ | ||
//jovem | ||
img.setAttribute('src', 'hJove.png') | ||
}else if(idade < 60){ | ||
//adulto | ||
img.setAttribute('src', 'hAdult.png') | ||
}else{ | ||
//idoso | ||
img.setAttribute('src', 'hIdoso.png') | ||
} | ||
|
||
}else if(fsex[1].checked){ | ||
genero='Mulher' | ||
if(idade >=0 && idade <10){ | ||
//criança | ||
img.setAttribute('src', 'mBaby.png') | ||
}else if(idade < 21){ | ||
//jovem | ||
img.setAttribute('src', 'mJove.png') | ||
}else if(idade < 60){ | ||
//adulto | ||
img.setAttribute('src', 'mAdult.png') | ||
}else{ | ||
//idoso | ||
img.setAttribute('src', 'mIdosa.png') | ||
} | ||
} | ||
res.style.textAlign='center' | ||
res.innerHTML =`Detectamos ${genero} com idade ${idade} anos.` | ||
res.appendChild(img) | ||
} | ||
} |