JS 用window.open()函数,父级页面如何取到子级页面的返回值?

时间:2014-07-19 09:34:48   收藏:0   阅读:2544
父窗口:
<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>

  

JS 用window.open()函数,父级页面如何取到子级页面的返回值?,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!