I have used ECMAscript to add a SVG element to a webpage (I added a mouseover event to an existing svg element and the function it refers to creates a rectangle;
Code:
function bla (evt) {
var svgNS = "http://www.w3.org/2000/svg";
var vierkant = document.createElementNS(svgNS,"rect");
rect1.setAttributeNS(null,"width",400);
rect1.setAttributeNS(null,"height",80);
rect1.setAttributeNS(null,"x",100);
rect1.setAttributeNS(null,"y",100);
rect1.setAttributeNS(null,"rx",20);
rect1.setAttributeNS(null,"ry",20);
rect1.setAttributeNS(null,"id","textblock");
rect1.setAttributeNS(null,"visability","true");
rect1.setAttributeNS(null,"stroke","black");
rect1.setAttributeNS(null,"fill","blue");
rect1.setAttributeNS(null,"fill-opacity",0.2);
document.getElementById("firstgroup").appendChild(rect1);
}
var test = svgDocument.getElementById("textblock");
test.parentNode.removeChild;
...would do the trick, but it doesn't.
Any ideas?
Robert
