Skip to content

Instantly share code, notes, and snippets.

@xnuk
Created May 5, 2014 18:47
Show Gist options
  • Select an option

  • Save xnuk/f0c13510a1242abd56dc to your computer and use it in GitHub Desktop.

Select an option

Save xnuk/f0c13510a1242abd56dc to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<style type="text/css">
#map td{border:1px solid black;padding:0;margin:0;border-spacing:0}
#map{border-collapse: collapse;width:500px;height:500px;position:absolute;}
.block{width:125px;height:125px;position:absolute;background-color:#9ccdeb;font-size:20pt;line-height:125px;text-align:center}
#play{width:500px;height:500px;position:relative;top:0px;left:0px;}
</style>
<script>
onload=function(){
var a=document.getElementById("map")
a.innerHTML="rddddrddddrddddrdddd".trim()
.replace(/rd/g,"<tr><td>&nbsp;</td>")
.replace(/d<tr>/g,"<td>&nbsp;</td></tr><tr>")
.replace(/d(?!>)/g,"<td>&nbsp;</td>")+"</tr>"
}
function Block(a,b,c){
this.remove=function(){
document.getElementById("play").removeChild(this.element);
}
this.x=a;
this.y=b;
this.value=c;
var d=this.element=document.createElement('div');
d.className="block"
d.style.left=125*a+"px";
d.style.top=125*b+"px";
d.appendChild(document.createTextNode(c));
document.getElementById("play").appendChild(d);
}
</script>
</head>
<body>
<section id="main">
<table id="map"></table>
<section id="play"></section>
</section>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment