window.showModalDialog 传值运用

来源:互联网 发布:陈意涵长相知乎 编辑:程序博客网 时间:2024/04/29 14:42

 var obj = new Object();
     obj.lastResult="";
     if(c_SelectedId.value !="" && c_SelectedName.value!="")
     {
        obj.lastResult = c_SelectedId.value;
     }
    //设置obj参数,进行传值
    var result= window.showModalDialog('<%=HelperPageName %>',obj,"dialogHeight:500px;dialogWidth:400px;resizable: yes; status: no; scroll: no; help: no; center: yes;");

 

在子页面读取:

 if (window.dialogArguments != undefined
                && window.dialogArguments.lastResult != undefined
                && window.dialogArguments.lastResult != "")

 {
                var str = window.dialogArguments.lastResult;

             //处理参数

 

在子页面向父页面传值:

var tmpVal = "dddd";
 var tmpText = "xxxx";

 window.returnValue = tmpVal + "|||" + tmpText;
            window.parent.close();
原创粉丝点击