gpt4 book ai didi

javascript - 更新 JS 以使用 IE10

转载 作者:行者123 更新时间:2023-11-30 06:30:08 24 4
gpt4 key购买 nike

我的任务是为 IE10 更新一些 Javascript。我一直在无休止地寻找解决方案,但似乎找不到。我卡住的那段代码是:

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);
else
this.svgDoc.getDocumentElement.appendChild(this.grp);

最后一行是它失败的地方,给我错误无法获取未定义或空引用的属性appendChild。我似乎无法弄清楚为什么它是空引用,因为它适用于 IE8 及更低版本。

最佳答案

getDocumentElement 应该只是 documentElement根据 this 适用于几乎所有版本的 IE

关于javascript - 更新 JS 以使用 IE10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18183201/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com