• retunValue与opener的用法


    两个也页面

    1.html代码:

    代码
    <html>
    <head>
        
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        
    <title>1.aspx</title>

        
    <script language="javascript" type="text/javascript">
        function onObjMore(url,name,height,width,formName)
        {
             var feature 
    = "dialogWidth:"+width+"px;dialogHeight:"+height+"px;scroll:yes;status:no;help:no;center:1";
             var returnTarget 
    = window.showModalDialog(url, name, feature);
             
    if(returnTarget != undefined && returnTarget.length > 1
             {
                formName.file.value
    =returnTarget;
             }
             
    return false;
        }
        function myopen()
        {
            window.open(
    "2.aspx");
        }
        
    </script>

    </head>
    <body>
        
    <form name="proForm" method="post" action="">
        
    <table width="400" border="0" cellpadding="0" cellspacing="0">
            
    <tr>
                
    <td style="white-space: nowrap">
                    显示子2.aspx内容:
                
    </td>
                
    <td width="307" height="25">
                      
    <input name="file" type="text" id="file"/>
                
    </td>
            
    </tr>
            
    <tr>
                
    <td height="25">
                    
    <input type="button" name="Submit" value="retunValue使用" onclick="onObjMore('2.aspx','upfile',300,300,proForm)"/>
                
    </td>
            
    </tr>
        
    </table>
        此值传递到2.aspx:
        
    <input id="oneValue" type="text"/>
        
    <input id="Button1" type="button" value="opener使用" onclick="myopen()"/>
        
    </form>
    </body>
    </html>

    2.html代码

    代码
    <html>
    <head>
        
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        
    <title>abc.aspx</title>

        
    <script language="javascript" type="text/javascript">
        function exit()
        {
            window.returnValue 
    = document.getElementById("twoValue").innerHTML;
            window.close();
        }
        function aaa()
        {
            
    if(opener != null)
            {
                document.getElementById(
    "showOne").value = opener.document.proForm.oneValue.value;
            }
        }
        
    </script>

    </head>
    <body onload="aaa()">
        
    <span id="twoValue">abcdef</span>
        
    <br />
        
    <input name="" type="button" value="关闭窗口" onclick="exit()" />
        
    <p></p>    
        显示1.aspx输入的内容:
    <input id="showOne" type="text"/>
    </body>
    </html>


  • 相关阅读:
    当当网首页——JS代码
    当当网首页——CSS代码
    离散与连续 分度值
    timepicker php strtotime 8hours
    w[wi].disabled = true;
    Browser Cookie Limits
    FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)
    递归需要有边界条件、递归前进段和递归返回段。当边界条件不满足时,递归前进;当边界条件满足时,递归返回。
    从交集角度考虑订房系统的时间连续性
    glup 压缩图片
  • 原文地址:https://www.cnblogs.com/ycsfwhh/p/1641401.html
Copyright © 2020-2023  润新知