-
-
Save OfTheDelmer/3ab4f79efe090c483085 to your computer and use it in GitHub Desktop.
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> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.blue { | |
background-color: blue; | |
color: white; | |
} | |
.red { | |
background-color: red; | |
color: white; | |
} | |
.green { | |
background-color: green; | |
} | |
</style> | |
</head> | |
<body id="body"> | |
<script id="jsbin-javascript"> | |
// wait for the window.onload to run the function | |
$(function() { | |
// converted to a DOM element | |
var $gameBoard = $("<div></div>"); | |
$("#body").append($gameBoard) | |
var interval = 1500; | |
var generateRand = function () { | |
var randCode = Math.floor(Math.random()*25 + 97); | |
var chr = String.fromCharCode(randCode); | |
var $chrDiv = $("<span>" + chr + "</span>"); | |
$chrDiv.addClass("red"); | |
$chrDiv.addClass("" + randCode); | |
$gameBoard.append($chrDiv); | |
setTimeout(generateRand, interval); | |
}; | |
setTimeout(generateRand, interval); | |
}); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-1.11.1.min.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body id="body"> | |
</body> | |
</html></script> | |
<script id="jsbin-source-css" type="text/css">.blue { | |
background-color: blue; | |
color: white; | |
} | |
.red { | |
background-color: red; | |
color: white; | |
} | |
.green { | |
background-color: green; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
// wait for the window.onload to run the function | |
$(function() { | |
// converted to a DOM element | |
var $gameBoard = $("<div></div>"); | |
$("#body").append($gameBoard) | |
var interval = 1500; | |
var generateRand = function () { | |
var randCode = Math.floor(Math.random()*25 + 97); | |
var chr = String.fromCharCode(randCode); | |
var $chrDiv = $("<span>" + chr + "</span>"); | |
$chrDiv.addClass("red"); | |
$chrDiv.addClass("" + randCode); | |
$gameBoard.append($chrDiv); | |
setTimeout(generateRand, interval); | |
}; | |
setTimeout(generateRand, interval); | |
});</script></body> | |
</html> |
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
.blue { | |
background-color: blue; | |
color: white; | |
} | |
.red { | |
background-color: red; | |
color: white; | |
} | |
.green { | |
background-color: green; | |
} |
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
// wait for the window.onload to run the function | |
$(function() { | |
// converted to a DOM element | |
var $gameBoard = $("<div></div>"); | |
$("#body").append($gameBoard) | |
var interval = 1500; | |
var generateRand = function () { | |
var randCode = Math.floor(Math.random()*25 + 97); | |
var chr = String.fromCharCode(randCode); | |
var $chrDiv = $("<span>" + chr + "</span>"); | |
$chrDiv.addClass("red"); | |
$chrDiv.addClass("" + randCode); | |
$gameBoard.append($chrDiv); | |
setTimeout(generateRand, interval); | |
}; | |
setTimeout(generateRand, interval); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment