【发布时间】:2011-12-26 02:37:23
【问题描述】:
以下代码在 chrome 和 Firefox 中运行良好,但在 IE 9.0 中中断
//select div where svg is to be inserted
var selSVG = document.getElementById('SVGMap');
//clear any SVG
while (selSVG.hasChildNodes()) {
selSVG.removeChild(selSVG.lastChild);
}
//add the new svg
selSVG.appendChild(loadXML("roomlayouts/"+SelectedRoomAddress));
使用 loadXML(...) 从另一个文件夹返回 svg 文档,并且在 DOM 异常的最后一行出现错误:HIERARCHY_REQUEST_ERR (3) line 300 character 2
任何想法为什么它不能在 IE 9.0 中工作?
【问题讨论】:
-
loadXML究竟返回了什么? -
它返回一个完整的 SVG 文档,例如:chocolatezombies.com/classroom/roomlayouts/S110.svg
-
@999 我应该说它返回 SVG 文件的文档元素。抱歉,只是更仔细地查看了我的代码。复制下面的函数 function loadXML(url) { var xmlhttp = new window.XMLHttpRequest(); xmlhttp.open("GET", url, false); //停止烦人的缓存! xmlhttp.setRequestHeader("缓存控制", "无缓存"); //正如上面所说的 xmlhttp.send(null);返回 xmlhttp.responseXML.documentElement; }
标签: javascript svg internet-explorer-9