解决在Chrome下无法获取showModalDialog返回值的问题
2012-11-13 17:24
567 查看
今天发送的bug,正常情况下用IE和FF测试showModalDialog方法,在子页面将处理的结果赋值给window.returnValue,关闭子页面,在父页面可以通过varresult=window.showModalDialog(…)获取到结果。
但chrome下result是undefine。
解决的办法就是,在设置返回结果时,也为window.opener.returnValue赋值。
[code]varresult=window.showModelDialog(....);
[/code]
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
但chrome下result是undefine。
解决的办法就是,在设置返回结果时,也为window.opener.returnValue赋值。
//父页面调用showModalDialog
[code]varresult=window.showModelDialog(....);
//forchrome
if(!result)
{
result=window.returnValue;
}
if(result)
{
//IE/FF/CHROME都可以正常使用result
}
//子页面
varresultObj={Pass:true};
if(window.opener)
{
window.opener.returnValue=resultObj;
}
window.returnValue=resultObj;
[/code]
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
相关文章推荐
- Chrome不支持showModalDialog模态对话框和无法返回returnValue问题的解决方法
- Chrome中模态对话框showModalDialog返回值问题的解决方法
- Chrome中模态对话框showModalDialog返回值问题的解决方法
- Chrome中模态对话框showModalDialog返回值问题的解决方法
- Chrome中模态对话框showModalDialog返回值问题的解决方法
- 解决chrome浏览器无法得到window.showModalDialog返回值的问题
- 解决dynamips无法获取网卡参数的问题
- 解决Sql Server Reporting Service在Chrome下无法显示Datepicker的问题
- android google map 开发中的常见问题及解决(无法获取 google map apiKey 和Couldn't get connection factory client)
- showModalDialog在chrome下无返回值的问题
- 解决由于设置BatchExecutor批量执行器而导致无法获取自增Id的问题
- 解决模式窗口(showModalDialog)下无法复制文本的问题
- FileProvider无法获取外置SD卡问题解决方案 | Failed to find configured root that contains
- AngularJS出现$http异步后台无法获取请求参数问题的解决方法
- 关于ubuntu12.04下google-chrome无法启动问题的解决
- Linux CentOS设置静态获取ip,解决无法上网问题
- .net 2.0 中对于非服务器端的input元素 type为file后台无法获取的问题的解决方法
- JS代码获取当前日期时支持IE,不兼容FF和chrome,解决这个问题,我们需要把获取时间的getYear()函数换成getFullYear()
- 安卓手机wifi 无法获取ip问题解决
- C# ASP.net 解决easyui treegrid传递参数后台无法获取的问题