Skip to content

Instantly share code, notes, and snippets.

@rnaud
Created February 20, 2011 14:43
Show Gist options
  • Save rnaud/836019 to your computer and use it in GitHub Desktop.
Save rnaud/836019 to your computer and use it in GitHub Desktop.
Check the values given by asterix.js
<!doctype html>
<html>
<head>
<style>
#solution {
width: 600px;
margin: 0 auto;
}
.check {
width: 198px;
height: 198px;
border: 1px solid black;
background: #ccc;
float: left;
position: relative;
}
.check .top {
position: absolute;
top: 0;
left: 25%;
}
.check .right {
position: absolute;
top: 25%;
right: 0;
}
.check .bottom {
position: absolute;
bottom: 0;
left: 25%;
}
.check .left {
position: absolute;
top: 25%;
left: 0;
}
</style>
</head>
<body>
<div id="solution"></div>
</body>
<script>
var bla = [[{"type":"c","head":2},{"type":"o","head":2},{"type":"a","head":1},{"type":"p","head":1}],[{"type":"c","head":2},{"type":"p","head":1},{"type":"o","head":1},{"type":"a","head":2}],[{"type":"p","head":2},{"type":"c","head":2},{"type":"a","head":1},{"type":"c","head":2}],[{"type":"o","head":2},{"type":"p","head":1},{"type":"c","head":1},{"type":"a","head":2}],[{"type":"p","head":2},{"type":"o","head":2},{"type":"p","head":1},{"type":"a","head":1}],[{"type":"c","head":2},{"type":"a","head":1},{"type":"o","head":1},{"type":"a","head":2}],[{"type":"a","head":2},{"type":"c","head":2},{"type":"p","head":1},{"type":"o","head":1}],[{"type":"a","head":1},{"type":"c","head":1},{"type":"p","head":2},{"type":"o","head":2}],[{"type":"o","head":2},{"type":"a","head":1},{"type":"p","head":1},{"type":"c","head":2}]];
var string = "";
for (i=0; i<9; i++) {
string += '<div class="check">';
string += '<div class="top">'+bla[i][0].type+"-"+bla[i][0].head+'</div>';
string += '<div class="right">'+bla[i][1].type+"-"+bla[i][1].head+'</div>';
string += '<div class="bottom">'+bla[i][2].type+"-"+bla[i][2].head+'</div>';
string += '<div class="left">'+bla[i][3].type+"-"+bla[i][3].head+'</div>';
string += '</div>';
}
var solution = document.getElementById("solution");
solution.innerHTML = string;
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment