JS模态窗口返回值兼容问题解决方案

作者:互联网   出处:控件中国网   2014-11-05 19:05:30   阅读:1

JS模态窗口返回值兼容问题解决方案

1、打开弹出窗口时把 window 作为第二个参数传入。

 var result = window.showModalDialog(url, window, "dialogWidth=" + width + "px;dialogHeight=" + height + "px;resizable:yes;")

 if (typeof (result) == 'undefined') {

         result = window.ReturnValue;

     }

     return result;

2、在弹出窗口中,执行如下JS,以接收传入的window

 if (typeof (window.opener) == 'undefined') window.opener = window.dialogArguments;

 

3、弹出窗口关闭前,调用如下JS赋返回值

 window.retureValue = vals;

        if (window.opener && window.opener != null)

                window.opener.ReturnValue = vals;

 

        window.close();

 

Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat