zoukankan      html  css  js  c++  java
  • 1.showModalDialog返回值给父窗口 2.winow.open开的窗口赋值给父窗口

    子窗口:
    function SelectIdInfo(rowId)
              
    {
                   window.dialogArguments[
    0].document.getElementById(window.dialogArguments[1]).value =Grid1.GetRowFromClientId(rowId).GetMember('INVTITLE_NAME').Text;               
                   window.close();
              }
    父窗口:
    <id="btnSearch" href="#" onclick="return OpenNewForm1();" runat="server" >检索</a>
     function OpenNewForm1()//invoked by "btnSearch"--->检索“开票抬头”,由invoice_inv_title_choose.aspx传回本页面
            {
              
    var varParentId;
              varParentId
    =document.getElementById("hidCompanyID").value
              
              
    var url = "invoice_inv_title_choose.aspx?pare_id="+varParentId+"";//dbo.PD_COMPANY.COMP_C_CNAME 涉帐单位 SZDW对应的ID
              var myReturnValue=0;
              myReturnValue
    =window.showModalDialog(url,[window,document.getElementById("txtTitle").id],"status:Modeless;edge:raised;unadorned:no;scroll=no;resizable:yes;center=yes;help:no;dialog555px;dialogheight:395px");
            }

    **************************************************
    父窗口:
    //配载船舶 按钮 弹出 sel_job_cq.aspx:选择"船名" "航次"
            function OpenNewForm1()
            
    {        
                  
    var myReturnValue = 0;
                  myReturnValue
    =window.showModalDialog('sel_job_cq.aspx',[window,document.getElementById("tbVessel").id,document.getElementById("tbVoy").id],"status:Modeless;edge:raised;unadorned:no;scroll=no;resizable:yes;center=yes;help:no;dialog615px;dialogheight:398px");
            }
    子窗口:
     //"选择"链接 最右边----返回值给父窗口:view_job_dcpz.aspx
             function SelectIdInfo(rowId)
             
    {
                   window.dialogArguments[
    0].document.getElementById(window.dialogArguments[1]).value =Grid1.GetRowFromClientId(rowId).GetMember('vessel').Text;
                   window.dialogArguments[
    0].document.getElementById(window.dialogArguments[2]).value =returnValue=Grid1.GetRowFromClientId(rowId).GetMember('voy').Text; //returnValue 
                   window.close();
             }
    /////////////////////////////////////////////////////
    父窗口:
     function AddUrl1()//invoked by "联系信息" <img>
            {
               
    var a=document.form1.Pub_ddl7$tbName.value;
               
    var b=document.form1.Pub_ddl1$tbName.value;
               
    var c=document.form1.Pub_ddl4$tbName.value;
               
    var d=document.form1.Pub_ddl7$tbCode.value;
              
               
    var urlGoto = "Sel_lxinfo.aspx?ccname="+a+"&lcname="+b+"&dcname="+c+"&id="+d;
               
    //window.showModalDialog(urlGoto,'',"status:Modeless;edge:raised;unadorned:no;scroll=no;resizable:yes;center:yes;help:no;dialog580px;dialogheight:610px"); 
               window.open(urlGoto,'','height=380,width=810,top=0,left=0,toolbar=no,menubar=no,scrollbars=no');
            }
    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    子窗口:
     function Change_ID(rowId)
         
    {
              
    var a=Grid1.GetRowFromClientId(rowId).GetMember('shipper_d').Text;
              
    var b=Grid1.GetRowFromClientId(rowId).GetMember('consignee_d').Text;
              
    var c=Grid1.GetRowFromClientId(rowId).GetMember('notifier_d').Text;
              
    var d=Grid1.GetRowFromClientId(rowId).GetMember('AGENT_D').Text;
              
    if(a!="")
              
    {
                window.opener.document.getElementById(
    "TextBox2").value=a;//window.opener代表父窗口
              }

              
    if(b!="")
              
    {
               window.opener.document.getElementById(
    "TextBox5").value=b;
              }

              
    if(c!="")
              
    {
                 window.opener.document.getElementById(
    "TextBox6").value=c;
              }

                 
            
                 window.opener.document.getElementById(
    "TextBox3").value=d;
             
           window.close();
         }


  • 相关阅读:
    cookie、session和会话保持
    常见的一些专业术语的概念
    JS中的执行机制(setTimeout、setInterval、promise、宏任务、微任务)
    加密和解密
    ASCII 、UTF-8、Unicode编码
    localhost、127.0.0.1、本机ip、0.0.0.0 的区别
    使用Bootstrap框架的HTML5页面模板
    js判断是否在微信浏览器中打开
    js获取url的参数
    js动态生成下拉列表
  • 原文地址:https://www.cnblogs.com/simhare/p/926512.html
Copyright © 2011-2022 走看看