Skip to content

Instantly share code, notes, and snippets.

@rurabe
Forked from NatashaTheRobot/gameoflife.html
Created July 21, 2012 04:18
Show Gist options
  • Save rurabe/3154557 to your computer and use it in GitHub Desktop.
Save rurabe/3154557 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang='en'>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<meta charset="UTF-8">
<style>
.cell{
width:50px ;
height:50px;
padding: 0px;
}
.board{
table-layout:fixed;
}
#test{
border: 2px solid;
height:100px;
width:100px;
}
</style>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div>
<table class="board">
<tr>
<td class="cell" id="11" >
</td>
<td class="cell" id="21" >
</td>
<td class="cell" id="31" >
</td>
<td class="cell" id="41" >
</td>
</tr>
<tr>
<td class="cell" id="12" >
</td>
<td class="cell" id="22" >
</td>
<td class="cell" id="32" >
</td>
<td class="cell" id="42" >
</td>
</tr>
<tr>
<td class="cell" id="13" >
</td>
<td class="cell" id="23" >
</td>
<td class="cell" id="33" >
</td>
<td class="cell" id="43" >
</td>
</tr>
<tr>
<td class="cell" id="14" >
</td>
<td class="cell" id="24" >
</td>
<td class="cell" id="34" >
</td>
<td class="cell" id="44" >
</td>
</tr>
</table>
</div>
<script>
var natasha = function(id){
$( "#"+id ).css( "background-image","url(https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/371703_2410829_741727003_q.jpg)" );
};
var ryan = function(id){
$( "#"+id ).css( "background-image","url(https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash2/372541_3403944_806268154_q.jpg)" );
};
var randomCell = function(){
return (Math.floor(Math.random()*4)+1).toString() + (Math.floor(Math.random()*4)+1).toString();
};
setInterval(function(){
Math.random()
$( ".cell" ).css( "background-image","" );
},500);
setInterval(function(){
Math.random()
ryan(randomCell());
},500);
setInterval(function(){
Math.random()
natasha(randomCell());
},500);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment