1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta content=
"text/html; charset=utf-8" http-equiv=
"Content-Type"/>
6 <link rel=
"stylesheet" href=
"../style/pixelless.css" type=
"text/css"/>
7 <link rel=
"stylesheet" href=
"style/triangles.css" type=
"text/css"/>
8 <script type=
"text/javascript" src=
"../script/util.js"></script>
9 <title>Triangular grid
</title>
13 <div class=
"content header">
14 <h1>Triangular grid
</h1>
18 <div id=
"map" class=
"hex">
20 <div class=
"empty_footer">
29 <script type=
"text/javascript" language=
"JavaScript">
30 if(!('console' in this))console = {log:function(){}}
32 function HexGrid(w,h,id)
34 var div = document.getElementById(id);
36 var row = '
<div>'+(new Array(w+
1)).join('
<u></u>')+'
</div>'
37 div.innerHTML = (new Array(h+
1)).join(row);
44 activate: function(i, j)
47 div.children[y].children[x].className = '';
52 div.children[y].children[x].className = 'active';
55 toggledraw: function()
65 var grid = new HexGrid(w, h, 'map');
73 window.onkeydown = function(e)
81 case
13:grid.toggledraw();break;
82 default:console.log(e);break;