Skip to content

Instantly share code, notes, and snippets.

Created January 7, 2015 18:15
Show Gist options
  • Save anonymous/dbd3d4561a29350ca526 to your computer and use it in GitHub Desktop.
Save anonymous/dbd3d4561a29350ca526 to your computer and use it in GitHub Desktop.
<!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>
.blue {
background-color: blue;
color: white;
}
.red {
background-color: red;
color: white;
}
.green {
background-color: green;
}
// 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