From 762ad54f1b1593fa6342e492e6061f9dde06e4a7 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Wed, 29 Jun 2016 11:35:10 +0200 Subject: [PATCH] try to draw 1000*1000 svg grig --- src/arenas/tron/js.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/arenas/tron/js.js b/src/arenas/tron/js.js index 1353172..60a2cda 100644 --- a/src/arenas/tron/js.js +++ b/src/arenas/tron/js.js @@ -1,4 +1,9 @@ - +function createElem(type,attributes){ + var elem=document.createElement(type); + for (var i in attributes) + {elem.setAttribute(i,attributes[i]);} + return elem; +} @@ -7,6 +12,9 @@ function tron(bot1,bot2,xdcheck){ while (document.getElementById('fightResult').firstChild) { document.getElementById('fightResult').removeChild(document.getElementById('fightResult').firstChild); } + + var mapImg = createElem('svg',{'alt' : 'map'}); + alert("plop"); // "circle" may be any tag name @@ -18,6 +26,7 @@ alert("plop"); shape.setAttribute("fill", "green"); // Add to a parent node; document.documentElement should be the root svg element. // Acquiring a parent element with document.getElementById() would be safest. - document.getElementById('fightResult').appendChild(shape); + mapImg.appendChild(shape); + document.getElementById('fightResult').appendChild(mapImg); }