Created
June 13, 2022 11:08
-
-
Save ssdev-95/4f8c4d8cdfb783ec8ff9a928790abc42 to your computer and use it in GitHub Desktop.
Irmão tezt input
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| </head> | |
| <body> | |
| <input type="number" id="txt" /> | |
| <button onclick="clicar()">clicar</button> | |
| <hr/> | |
| <p id="res"></p> | |
| <!-- ScrollReaveal Lib --> | |
| <script src="./main.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or 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
| const input = document.querySelector("#txt") | |
| const res = document.querySelector('#res') | |
| function clicar() { | |
| const idade = input.value | |
| let resposta = "" | |
| if (idade >= 18 && idade <= 69) { | |
| resposta = "vai votar" | |
| } else if (idade >= 16 && idade <= 17) { | |
| resposta = "Não precisa votar, mas pode" | |
| } else if (idade >= 0 && idade <= 15) { | |
| resposta = "Não vota" | |
| } else if (idade >= 70) { | |
| resposta = "Acima de 70 anos, voto não obrigatório" | |
| } else { | |
| resposta = "[Erro]" | |
| } | |
| res.innerText = resposta | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment