try to draw 1000*1000 svg grig
This commit is contained in:
parent
0a559d9f88
commit
762ad54f1b
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +13,9 @@ function tron(bot1,bot2,xdcheck){
|
||||||
document.getElementById('fightResult').removeChild(document.getElementById('fightResult').firstChild);
|
document.getElementById('fightResult').removeChild(document.getElementById('fightResult').firstChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mapImg = createElem('svg',{'alt' : 'map'});
|
||||||
|
|
||||||
|
|
||||||
alert("plop");
|
alert("plop");
|
||||||
// "circle" may be any tag name
|
// "circle" may be any tag name
|
||||||
var shape = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
var shape = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
||||||
|
@ -18,6 +26,7 @@ alert("plop");
|
||||||
shape.setAttribute("fill", "green");
|
shape.setAttribute("fill", "green");
|
||||||
// Add to a parent node; document.documentElement should be the root svg element.
|
// Add to a parent node; document.documentElement should be the root svg element.
|
||||||
// Acquiring a parent element with document.getElementById() would be safest.
|
// Acquiring a parent element with document.getElementById() would be safest.
|
||||||
document.getElementById('fightResult').appendChild(shape);
|
mapImg.appendChild(shape);
|
||||||
|
document.getElementById('fightResult').appendChild(mapImg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user