Last active
May 20, 2018 21:26
-
-
Save henrycunh/4f18f84f10196e918dbe144bfa3c15e5 to your computer and use it in GitHub Desktop.
Exercicio Bilbo
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
let elEntrada = document.getElementById('entrada') | |
let elSaida = document.getElementById('container') | |
let elForm = document.getElementById('formulario') | |
const gerarNumeros = (evento) => { | |
evento.preventDefault() | |
let numero = parseInt(elEntrada.value) | |
let saida = "" | |
for(let i = 0; i < numero; i++) | |
saida += Math.round(Math.random() * 100) + "<br>" | |
elSaida.innerHTML = saida | |
} | |
elForm.addEventListener('submit', gerarNumeros) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body{ | |
background: #333; | |
font-family: monospace; | |
color: #fff; | |
padding: 1em; | |
} | |
input, button{ | |
font-family: monospace; | |
border-radius:5px; | |
padding: .5em 1em; | |
} | |
#container{ | |
border: 2px dotted #666; | |
padding: 1em; | |
} | |
</style> | |
<title>Exercício</title> | |
</head> | |
<body> | |
<form id='formulario'> | |
<h2>Digite o valor</h2> | |
<input id='entrada'/> | |
<button type='submit'>Testar</button> | |
<h2>Números</h2> | |
<div id='container'></div> | |
</form> | |
</body> | |
<script src='app.js'></script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment