Created
September 5, 2014 19:14
-
-
Save christurnertv/2f1acecb073560b17d81 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<title>Disarm the BOM (Browser Object Model)</title> | |
</head> | |
<body> | |
<h1>Mission Impossible!</h1> | |
<button id="btnDisarm">Disarm the BOM!</button> | |
<script> | |
var detonationTimer = 10; // seconds | |
var intervalId = setInterval(function () { | |
detonationTimer--; | |
console.log(detonationTimer + '...'); | |
if (detonationTimer == 0) { | |
alert('BOMMMMM!!!'); | |
clearInterval(intervalId); | |
} | |
}, 1000); | |
var btnDisarm = document.getElementById('btnDisarm'); | |
btnDisarm.addEventListener('click', function () { | |
clearInterval(intervalId); | |
alert('You are a hero! You disarmed the BOM!'); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment