Created
September 3, 2018 09:40
-
-
Save tombasche/1037d63bf7c37231e4c5eed2ff4401f4 to your computer and use it in GitHub Desktop.
Generate random numbers up to 10
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"> | |
<title>Maths Group - Negative Numbers</title> | |
<style> | |
.header-body { | |
width: 100%; | |
height: 100%; | |
text-align: center; | |
vertical-align: middle; | |
position:absolute; | |
} | |
h1 { | |
font-size: 40em; | |
position: absolute; | |
width: 100%; | |
top: -0.5em; | |
} | |
</style> | |
<script type="text/javascript"> | |
window.onload = function() { | |
var el = document.getElementById('big-number'); | |
el.addEventListener('click', randomNumber); | |
}; | |
function randomNumber() { | |
var s = document.getElementById('number'); | |
s.innerHTML = Math.round(Math.random() * 11); | |
} | |
</script> | |
</head> | |
<body> | |
<div class="header-body" id="big-number"> | |
<h1 id="number">0</h1> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment