我有代码:
var c_iframe = document.createElement('iframe');
c_iframe.setAttribute('src', 'my_domain_and_url');
if (c_iframe.readyState) {
c_iframe.onreadystatechange = function () { // for old version of IE
if (this.readyState == 'complete' || this.readyState == 'loaded') {
resize();
}
};
} else { // other browsers
c_iframe.onload = resize;
}
此代码适用于IE边缘,但对于IE10和IE9,我正在
SCRIPT16389: Unknown error.
这一行:
if (c_iframe.readyState) {
我做错了什么,我需要什么?
答案 0 :(得分:0)
好的,我修好了:
var div = document.createElement("div");
div.innerHTML = "<!--[if lt IE 11]><i></i><![endif]-->";
var isIeLessThan11 = (div.getElementsByTagName("i").length == 1);
if (isIeLessThan11) {
quiz_iframe.onreadystatechange = function () { // for old version of IE
if (this.readyState == 'complete' || this.readyState == 'loaded') {
resize();
}
};
} else { // other browsers
quiz_iframe.onload = resize;
}
c_iframe.readyState
只是未定义..