我有一段 JavaScript 代码在 IE 中工作正常,但在 chrome 中 onreadystatechange 事件不会触发。
var oXml = document.createElement("XML");
document.body.appendChild(oXml);
oS = new Object();
oS.sXmlHttp = null;
oS.aXmlHttp = null;
oS.fPending = true;
oS.nextCall = null;
oS.lastCall = null;
oS.url = url;
oS._oXml = oXml;
oS.ns = new Array();
oS.nsalias = new Array();
if (options != null) {
oS.fSeq = options.reuseConnection;
oS.SOAPHeader = options.SOAPHeader;
}
if (oS.fSeq == null)
oS.fSeq = false;
_sdl[url] = oS;
oXml.service = userName;
oXml.onreadystatechange = getWsdl //event funtion not fires in chrome;
oXml.src = url;
在上面的代码中,onreadystatechange 在 Chrome 中不会触发。 请问有什么帮助吗?
最佳答案
问题不在于 chrome 没有触发该事件。只是该事件不存在。
var oXml = document.createElement("XML");
console.log( typeof oXml.onreadystatechange ); // this prints "undefined"
关于javascript - XMLDocument onreadystatechange 在 Chrome 中不会触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26345005/