Skip to content

Instantly share code, notes, and snippets.

@ssx
Created September 13, 2015 13:03
Show Gist options
  • Save ssx/71eec235778f25a4af65 to your computer and use it in GitHub Desktop.
Save ssx/71eec235778f25a4af65 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Coffee Generator</title>
<style type="text/css">
body {
background: #f3r3e3;
font-size: 40px;
text-align: center;
color: #000;
}
</style>
<script type="text/javascript">
var names = new Array("Chris E", "Chris T", "Rob", "Scott", "Simon", "Tom");
var timer;
function spinReel()
{
RandomName = Math.round(Math.random()*(names.length-1));
var change_box = document.getElementById('winner');
change_box.innerHTML = names[RandomName];
}
function startTimer()
{
timer = setInterval ("spinReel();", 80);
setTimeout(stopTimer, 5000);
}
function stopTimer()
{
clearInterval(timer);
var username = document.getElementById('winner').innerHTML;
}
</script>
</head>
<body onLoad="startTimer();">
<h2 id="winner">hi</h2>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment