0

我已经设法更改了很多此 javascript 以与 IE10 一起使用,但我遇到了另一个问题。这次我在 if (this.parent) 部分的代码行上得到一个Unable to get property 'appendChild' of undefined or null reference 。

var svgns = "http:///www.w3.org/2000/svg"
this.svgDoc = document.getElementById("SVGDoc").getSVGDocument();
this.grp = this.svgDoc.createElementNS(svgns, "g");
this.grp.setAttribute("id", this.id);

if (this.parent)
   this.svgDoc.getElementById(this.parent.id).appendChild(this.grp); //This Line
else
   this.svgDoc.getDocumentElement.appendChild(this.grp);

真的很困惑为什么会这样。有任何想法吗?

4

0 回答 0