昨天发现SupeSite/XSpace4.0的日志编辑器有bug,也就是在IE8下点击“插入表情”、“文本颜色”等的时候是弹出一个新的标签页,而不是弹出模态对话框,而且在弹出的对话框中选择表情的时候报错“dialogArguments is undefined”。
一开始我觉得是IE8中不支持dialogArguments 了,可是发现不对,由于IE8下“弹出一个新的标签页,而不是弹出模态对话框”,由于IE8是支持showModelessDialog/showModelessDialog、很显然在IE8下调用的不是showModalDialog或者showModelessDialog,而是window.open,打开编辑器的文件/p_w_picpaths/edit/edit.js,看到function oPenWin函数的定义:
function oPenWin(_sTitle, _sWidth, _sHeight, _sUrl, _bDialog, _open){
xposition=0; yposition=0; if ((parseInt(navigator.appVersion) >= 4 )) { xposition = (screen.width - _sWidth) / 2; yposition = (screen.height - _sHeight) / 2; } if(_open) { window.open(_sUrl,"win","menubar=no,location=no,resizable=no,scrollbars=no,status=no,left="+xposition+",top="+yposition+",width="+_sWidth+",height="+_sHeight); } else { if(window.Event) { window.open(_sUrl,"win","menubar=no,location=no,resizable=no,scrollbars=no,status=no,left="+xposition+",top="+yposition+",innerWidth="+_sWidth+",innerHeight="+_sHeight); } else { if(_bDialog == true) { showModelessDialog(_sUrl, window, "dialogHeight:"+(_sHeight+20)+"px;dialogWidth:"+_sWidth+"px;status:no;help:no;resizable:yes;status:no;tustatus:no;"); } else { showModalDialog(_sUrl, window, "dialogHeight:"+(_sHeight+20)+"px;dialogWidth:"+_sWidth+"px;status:no;help:no;resizable:yes;status:no;tustatus:no;"); } } }
不知道它在哪判断来判断去究竟是调用window.open仍是showModelessDialog仍是showModalDialog是在作什么,用这么复杂吗?直接调用showModalDialog/showModelessDialog不就好了吗?反正你调用window.open在对话框中也无法用dialogArguments (由于用window.open打开的窗口是得不到dialogArguments 的)。
因此修改以下,在if(_open) {上增长:
if(_bDialog == true)
{ showModelessDialog(_sUrl, window, "dialogHeight:"+(_sHeight+20)+"px;dialogWidth:"+_sWidth+"px;status:no;help:no;resizable:yes;status:no;tustatus:no;"); } else { showModalDialog(_sUrl, window, "dialogHeight:"+(_sHeight+20)+"px;dialogWidth:"+_sWidth+"px;status:no;help:no;resizable:yes;status:no;tustatus:no;"); } return;
搞定!
|