zoukankan      html  css  js  c++  java
  • js弹出模态与非模态页面

    js弹出模态与非模态页面
    1、非模态页面

    window.open()

    子页引用父页

    window.opener

    2、模态页面

    window.showModalDialog(url,window,"dialogHeight:200px;dialogWidth:200px;center:Yes;Help:No;Resizable:No;Status:Yes;Scroll:auto;Status:no;");

    子页引用父页window.parent.dialogArguments

    或者子页中window.returnValue = xxx;返回给父页var ret = window.showModalDialog()

    关于Chrome浏览器中模态窗体中页面无返回值的解决方案:

    父页面

    if (window.ActiveXObject) { //IE 
        $("#choose_entp").click(function() {
            var returnValue = window.showModalDialog("SelectEntpInfo.do?mod_code=${af.map.mod_code}&xxx=" + Math.random(), window, "dialogWidth:630px;status:no;dialogHeight:440px");
            if (returnValue != null) {
                setValue(returnValue.id, returnValue.name);
            }
        });
    } else { //非IE 
        $("#choose_entp").click(function() {
            window.open("SelectEntpInfo.do?mod_code=${af.map.mod_code}&xxx=" + Math.random(), 'newwindow', 'height=440,width=630,top=150,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
        });
    }
    
    function setValue(id, name) {
        $("#entp_id").val(id);
        $("#entp_name").val(name);
    }

    子页面:

    function getReturnValue(select_id,select_name){
        if(window.ActiveXObject){ //IE
            window.returnValue = {
                    id : select_id,
                    name :     select_name    
                    } ;
            window.close();
        }else{ //非IE
            if(window.opener) {
                window.opener.setValue(select_id,select_name) ;
            }
            window.close();
        }
    }
  • 相关阅读:
    linux软件必须安装到 /usr,/usr/local/ 吗?
    linux命令ps aux|grep xxx详解
    vim 命令,实用
    @Autowired 与@Resource的区别
    srpingmvc 上传图片到服务器
    Git-Windows安装初始
    python判断句子是否匹配某种模式
    50. Pow(x, n)
    49. Group Anagrams
    48. Rotate Image
  • 原文地址:https://www.cnblogs.com/limingluzhu/p/2299212.html
Copyright © 2011-2022 走看看