Discuz!7.2 在IE9下弹窗报错解决方案
Discuz!7.2 在IE9下对帖子进行管理操作或者其他有弹层的操作会出错, 在控制台中会报错, 如下图:以下是修复方法:
方法一:如果你没有修改过js文件的话,用下面的zip包里的两个文件覆盖 include/js/ 文件夹下相应的文件, 这两个文件是GBK编码的, 其他编码的同学请自行转码.
方法二:手动修改两个js文件
1.include\js\moderate.js
找到if(BROWSER.ie && !BROWSER.opera) {
var inp = document.createElement('<input name="topiclist[]" />');
} else {
var inp = document.createElement('input');
inp.name = 'topiclist[]';
}修改为try {
var inp = document.createElement('<input name="topiclist[]" />');
} catch(e) {
try {
var inp = document.createElement('input');
inp.name = 'topiclist[]';
} catch(e) {
return;
}
}2.include\js\common.jsfunction ajaxpost(formid, showid, waitid, showidclass, submitbtn, recall) {
var waitid = typeof waitid == 'undefined' || waitid === null ? showid : (waitid !== '' ? waitid : '');
var showidclass = !showidclass ? '' : showidclass;
var ajaxframeid = 'ajaxframe';
var ajaxframe = $(ajaxframeid);
var formtarget = $(formid).target;
var handleResult = function() {
var s = '';
var evaled = false;
showloading('none');
try {
if(BROWSER.ie) {
s = $(ajaxframeid).contentWindow.document.XMLDocument.text;
} else {
s = $(ajaxframeid).contentWindow.document.documentElement.firstChild.nodeValue;
}
} catch(e) {
if(AJAX['debug']) {
var error = mb_cutstr($(ajaxframeid).contentWindow.document.body.innerText.replace(/\r?\n/g, '\\n').replace(/"/g, '\\\"'), 200);
s = '<root>ajaxerror<script type="text/javascript" reload="1">showDialog(\'Ajax Error: \\n' + error + '\');</script></root>';
}
}
if(s != '' && s.indexOf('ajaxerror') != -1) {
evalscript(s);
evaled = true;
}
if(showidclass) {
$(showid).className = showidclass;
if(submitbtn) {
submitbtn.disabled = false;
}
}
if(!evaled && (typeof ajaxerror == 'undefined' || !ajaxerror)) {
ajaxinnerhtml($(showid), s);
}
ajaxerror = null;
if($(formid)) $(formid).target = formtarget;
if(typeof recall == 'function') {
recall();
} else {
eval(recall);
}
if(!evaled) evalscript(s);
ajaxframe.loading = 0;
$('append_parent').removeChild(ajaxframe);
};
if(!ajaxframe) {
if (BROWSER.ie) {
ajaxframe = document.createElement('<iframe name="' + ajaxframeid + '" id="' + ajaxframeid + '"></iframe>');
} else {
ajaxframe = document.createElement('iframe');
ajaxframe.name = ajaxframeid;
ajaxframe.id = ajaxframeid;
}
ajaxframe.style.display = 'none';
ajaxframe.loading = 1;
$('append_parent').appendChild(ajaxframe);
} else if(ajaxframe.loading) {
return false;
}
_attachEvent(ajaxframe, 'load', handleResult);
showloading();
$(formid).target = ajaxframeid;
$(formid).action += '&inajax=1';
$(formid).submit();
return false;
}修改为function ajaxpost(formid, showid, waitid, showidclass, submitbtn, recall) {
var waitid = typeof waitid == 'undefined' || waitid === null ? showid : (waitid !== '' ? waitid : '');
var showidclass = !showidclass ? '' : showidclass;
var ajaxframeid = 'ajaxframe';
var ajaxframe = $(ajaxframeid);
var curform = $(formid);
var formtarget = curform.target;
var handleResult = function() {
var s = '';
var evaled = false;
showloading('none');
try {
s = $(ajaxframeid).contentWindow.document.XMLDocument.text;
} catch(e) {
try {
s = $(ajaxframeid).contentWindow.document.documentElement.firstChild.wholeText;
} catch(e) {
try {
s = $(ajaxframeid).contentWindow.document.documentElement.firstChild.nodeValue;
} catch(e) {
s = '内部错误,无法显示此内容';
}
}
}
if(s != '' && s.indexOf('ajaxerror') != -1) {
evalscript(s);
evaled = true;
}
if(showidclass) {
$(showid).className = showidclass;
if(submitbtn) {
submitbtn.disabled = false;
}
}
if(submitbtn) {
submitbtn.disabled = false;
}
if(!evaled && (typeof ajaxerror == 'undefined' || !ajaxerror)) {
ajaxinnerhtml($(showid), s);
}
ajaxerror = null;
if($(formid)) $(formid).target = formtarget;
if(typeof recall == 'function') {
recall();
} else {
eval(recall);
}
if(!evaled) evalscript(s);
ajaxframe.loading = 0;
if(!BROWSER.firefox) {
$('append_parent').removeChild(ajaxframe.parentNode);
} else {
setTimeout(
function(){
$('append_parent').removeChild(ajaxframe.parentNode);
},
100
);
}
};
if(!ajaxframe) {
var div = document.createElement('div');
div.style.display = 'none';
div.innerHTML = '<iframe name="' + ajaxframeid + '" id="' + ajaxframeid + '" loading="1"></iframe>';
$('append_parent').appendChild(div);
ajaxframe = $(ajaxframeid);
} else if(ajaxframe.loading) {
return false;
}
_attachEvent(ajaxframe, 'load', handleResult);
showloading();
curform.target = ajaxframeid;
var action = curform.getAttribute('action');
curform.action = action.replace(/\&inajax\=1/g, '')+'&inajax=1';
curform.submit();
if(submitbtn) {
submitbtn.disabled = true;
}
doane();
return false;
}
页:
[1]