<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Board test</title> <style type="text/css"> table.board { border: 1px solid #ccc; margin: 0px; padding: 0px; } td img { vertical-align: middle; } td { margin: 0px; padding: 0px; } td.empty { background-color: #55627A; width: 50px; height: 50px; } /* #1 */ td.wall_bottom { background-color: #fff; width: 50px; height: 50px; border-bottom: 1px solid #000; } /* #2 */ td.wall_right_left { background-color: #fff; width: 50px; height: 50px; border-left: 1px solid #000; border-right: 1px solid #000; } /* #3 */ td.wall_right_left_bottom { background-color: #fff; width: 50px; height: 50px; border-left: 1px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000; } /* #4 */ td.wall_left_bottom { background-color: #fff; width: 50px; height: 50px; border-left: 1px solid #000; border-bottom: 1px solid #000; } /* #5 */ td.wall_left_top { background-color: #fff; width: 50px; height: 50px; border-left: 1px solid #000; border-top: 1px solid #000; } /* #6 */ td.wall_left { background-color: #fff; width: 50px; height: 50px; border-left: 1px solid #000; } /* #7 */ td.wall_left_top_bottom { background-color: #fff; width: 50px; height: 50px; border-left: 1px solid #000; border-top: 1px solid #000; border-bottom: 1px solid #000; } /* #8 */ td.wall_top { background-color: #fff; width: 50px; height: 50px; border-top: 1px solid #000; } /* #9 */ td.wall_right_top_bottom { background-color: #fff; width: 50px; height: 50px; border-top: 1px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000; } /* #10 */ td.wall_right_bottom { background-color: #fff; width: 50px; height: 50px; border-right: 1px solid #000; border-bottom: 1px solid #000; } /* #11 */ td.wall_right_top { background-color: #fff; width: 50px; height: 50px; border-right: 1px solid #000; border-top: 1px solid #000; } /* #12 */ td.wall_right { background-color: #fff; width: 50px; height: 50px; border-right: 1px solid #000; } /* #13 */ td.wall_right_left_top { background-color: #fff; width: 50px; height: 50px; border-left: 1px solid #000; border-right: 1px solid #000; border-top: 1px solid #000; } /* #14 */ td.wall_bottom_top { background-color: #fff; width: 50px; height: 50px; border-bottom: 1px solid #000; border-top: 1px solid #000; } </style> </head> <body onload="build(10)"> <script type="text/javascript">
// собстно сама таблица var board = [ 0, 0, 0, 0, 0, 0, 5, 9, 0, 0, 0, 5, 14, 14, 11, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 2, 0, 0, 0, 0, 4, 11, 5, 10, 0, 2, 0, 5, 11, 0, 0, 2, 2, 0, 5, 10, 0, 6, 12, 13, 0, 2, 2, 0, 2, 0, 0, 6, 10, 4, 14, 1, 4, 14, 12, 0, 5, 10, 0, 0, 0, 0, 0, 0, 6, 14, 10, 0, 0, 0, 0, 0, 0, 7, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, ];
var items = [ {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1018.png", width: 25, height: 50, title: "Пустынник Атаман", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1019.png", width: 25, height: 50, title: "Проклятье Глубин", src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1017.png", width: 25, height: 50, title: "Пустынник Маньяк", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1017.png", width: 25, height: 50, title: "Пустынник Маньяк", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1016.png", width: 25, height: 50, title: "Пустынник Убийца", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1016.png", width: 25, height: 50, title: "Пустынник Убийца"}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1018.png", width: 25, height: 50, title: "Пустынник Атаман"}, {src: "http://img.combats.ru/i/chars/d/0/1016.png", width: 25, height: 50, title: "Пустынник Убийца", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1019.png", width: 25, height: 50, title: "Проклятье Глубин", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1016.png", width: 25, height: 50, title: "Пустынник Убийца"}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1017.png", width: 25, height: 50, title: "Пустынник Маньяк", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1019.png", width: 25, height: 50, title: "Проклятье Глубин"}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1017.png", width: 25, height: 50, title: "Пустынник Маньяк"}, {src: "http://img.combats.ru/i/chars/d/0/1019.png", width: 25, height: 50, title: "Проклятье Глубин", src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1017.png", width: 25, height: 50, title: "Пустынник Маньяк", src2: "http://img.combats.ru/i/chars/d/0/1018.png", width2: 25, height2: 50, title2: "Пустынник Атаман"}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1019.png", width: 25, height: 50, title: "Проклятье Глубин"}, {src: "http://img.combats.ru/i/chars/d/0/1016.png", width: 25, height: 50, title: "Пустынник Убийца"}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1017.png", width: 25, height: 50, title: "Пустынник Маньяк", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/chars/d/0/1019.png", width: 25, height: 50, title: "Проклятье Глубин", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: "http://img.combats.ru/i/objects/les1up1.png", width: 50, height: 50, title: "Вход", src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false}, {src: false, width: false, height: false, title: false, src2: false, width2: false, height2: false, title2: false} ];
// {src: "http://img.combats.ru/i/chars/d/0/10.png", width: 25, height: 50, title: ""}
var btypes = ["empty", "wall_bottom", "wall_right_left", "wall_right_left_bottom", "wall_left_bottom", "wall_left_top", "wall_left", "wall_left_top_bottom", "wall_top", "wall_right_top_bottom", "wall_right_bottom", "wall_right_top", "wall_right", "wall_right_left_top", "wall_bottom_top"];
function build(width) { var b = document.createElement("table"); b.className = "board"; b.setAttribute("cellspacing", "0"); b.setAttribute("cellpadding", "0"); for (var i = 0; i < board.length / width; i++) { var row = b.insertRow(i); for (var j = 0; j < width; j++) { var cell = row.insertCell(j); cell.className = btypes[board[i * width + j]]; if (items[i * width + j].src !== false) { if (!items[i * width + j].src2) { cell.innerHTML = '<img src="' + items[i * width + j].src + '" alt="Morgenshtern" title="' + items[i * width + j].title + '" width="' + items[i * width + j].width + '" height="' + items[i * width + j].height + '" />'; } else { cell.innerHTML = '<img src="' + items[i * width + j].src + '" alt="Morgenshtern" title="' + items[i * width + j].title + '" width="' + items[i * width + j].width + '" height="' + items[i * width + j].height + '" /><img src="' + items[i * width + j].src2 + '" alt="Morgenshtern" title="' + items[i * width + j].title2 + '" width="' + items[i * width + j].width2 + '" height="' + items[i * width + j].height2 + '" />'; } } } } document.getElementById("dungeon").appendChild(b); } function clear_area() { document.getElementById("dungeon").innerHTML = ''; }
</script>
<p> <div id="dungeon" style="border: 2px dotted maroon; padding: 10px"></div> </p>
<p><a href="javascript://" onclick="clear_area()">test</a></p>
</body> </html>
|