Created
August 12, 2012 15:52
-
-
Save mlegenhausen/3332403 to your computer and use it in GitHub Desktop.
JavaScript Workshop connect-four setup
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
(function(window, document, undefined) { | |
var $table = document.getElementById('field'); | |
function columnClick(col) { | |
} | |
function buildTable() { | |
var $row, $col, i, j; | |
for (i = 0; i < ROWS; i++) { | |
$row = document.createElement('tr'); | |
for (j = 0; j < COLUMNS; j++) { | |
$col = document.createElement('td'); | |
$col.onclick = columnClick.bind(this, j); | |
$row.appendChild($col); | |
} | |
$table.appendChild(row); | |
} | |
} | |
buildTable(); | |
})(window, document); |
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> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Vier Gewinnt</title> | |
<style> | |
* { | |
font-family:sans-serif; | |
} | |
table { | |
background-color:#0000FF; | |
} | |
td { | |
background-color:#FFFFFF; | |
cursor:pointer; | |
width:60px; | |
height:60px; | |
border-radius: 30px; | |
border: 1px solid; | |
} | |
p { | |
font-size:larger; | |
} | |
td.player-red { | |
background-color:#FF0000; | |
} | |
td.player-yellow { | |
background-color:#FFCC33; | |
} | |
span.player-red { | |
color:#FF0000; | |
} | |
span.player-yellow { | |
color:#FFCC33; | |
} | |
span.even { | |
color:#000000; | |
} | |
</style> | |
</head> | |
<body style="width:450px; margin:0 auto;"> | |
<h1>Vier Gewinnt</h1> | |
<p><b>Spieler:</b> <span id="player"></span></p> | |
<table id="field"></table> | |
<script src="app.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment