zoukankan      html  css  js  c++  java
  • JS 用window.open()函数,父级页面如何取到子级页面的返回值?

    父窗口:
    <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="../js/jquery-1.7.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { // alert($("test1").val()); // $("#text").val($("test1").val()); $("#Button1").click(function () { var win = window.open("../WebForm1.aspx", null, " height=300,width=450, Left=300px,Top=20px, menubar=no,titlebar=no,scrollbar=no,toolbar=no, status=no,location=no"); }); } ); </script> </head> <body> <form id="form1" runat="server"> <div> <input name="text" id="text1" type="text" /><input type="button" id="Button1"/> <asp:Button ID="Button2" runat="server" Text="Button" /> </div> </form> </body> </html>

    子窗口:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
      <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
        <title></title>
        <script type="text/javascript">
    
            function Button1_onclick() {
                window.opener.$("#text1").val("ddd");
                //            alert(window.opener.$("#text1").val());
                self.close();
            }
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
         <input type="submit" id="Button1" onclick="return Button1_onclick()" />
        </div>
        </form>
    </body>
    </html>
    

      

  • 相关阅读:
    self 和 super 关键字
    NSString类
    函数和对象方法的区别
    求两个数是否互质及最大公约数
    TJU Problem 1644 Reverse Text
    TJU Problem 2520 Quicksum
    TJU Problem 2101 Bullseye
    TJU Problem 2548 Celebrity jeopardy
    poj 2586 Y2K Accounting Bug
    poj 2109 Power of Cryptography
  • 原文地址:https://www.cnblogs.com/wangzhenghua/p/3854217.html
Copyright © 2011-2022 走看看