Created
May 5, 2014 18:47
-
-
Save xnuk/f0c13510a1242abd56dc to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
| <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> </td>") | |
| .replace(/d<tr>/g,"<td> </td></tr><tr>") | |
| .replace(/d(?!>)/g,"<td> </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