0

我有一个按钮,它将打开一个弹出窗口,弹出窗口重定向到几个页面并返回到最后一页,

现在我想在父打开窗口中获取最后一页的状态

我试过这个

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        ?>
        <button id="imageinstagram">Images</button>
        <script src="jquery-1.7.2.min.js" type="text/javascript"></script>
        <script>
            $(document).ready(function(){
                $('#imageinstagram').click(function(){
                    window.open("./login.php",'','menubar=no,status=no,width=200,height=200') ;
                });

            });
            function HandlePopupResult(result) {
                alert("result of popup is: " + result);
            }
        </script>
    </body>
</html>

现在 login.php 重定向到 success.php

success.php 有以下代码

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>        
            <script>
            function CloseMySelf(sender) {
                try {
                    window.opener.HandlePopupResult(sender.getAttribute("result"));
                }
                catch (err) {}
                window.close();
                return false;
            }

            CloseMySelf();
        </script>

    </body>
</html>

仍然我的父窗口没有收到任何警报

4

1 回答 1

0

I have done silly mistake without understanding the code :(

silly mistake in javascript of child window.

<script>
            function CloseMySelf() {
                try {
                    window.opener.HandlePopupResult('false');
                }
                catch (err) {}
                window.close();
                return false;
            }

            CloseMySelf();
        </script>
于 2013-04-10T04:47:29.543 回答