php弹出窗口问题

时间:2015-07-09 07:44:04

标签: php jquery get popup show

我有三个弹出窗口,如果$_GET变量$message是:changeSuccesschangeSuccessMenuchangeSuccessEvent,则会显示这些窗口。这里的问题是,即使此值为changeSuccessEvent,它仍会显示第二个值:changeSuccessMenu。请帮忙。

代码(PHP):

                    $message = $_GET['message'];
                    if($message == "changeSuccess")
                    {
                        echo '
                        <script type="text/javascript">
                        $(document).ready(function()
                        {
                            $("#screenCover").slideToggle("slow");
                            $("#closePopup").click(function()
                            {
                                $("#screenCover").slideToggle("slow");
                                setTimeout(resetPage, 600);
                            });
                        });
                        function resetPage()
                        {
                            window.location.replace("../admin/admintable.php?page=main");
                        }
                        </script>
                        <div id="screenCover" style="display:none;">
                        <div id="popup">
                        <div id="closePopupMain">
                        <p id="closePopup"><a href="#">X</a></p>
                        </div>
                        <p id="success">La page à éte modifiée!</p>
                        </div>
                        </div>';
                    }
                    else if($message = "changeSuccessMenu")
                    {
                        echo '
                        <script type="text/javascript">
                        $(document).ready(function()
                        {
                            $("#screenCover").slideToggle("slow");
                            $("#closePopup").click(function()
                            {
                                $("#screenCover").slideToggle("slow");
                                setTimeout(resetPage, 600);
                            });
                        });
                        function resetPage()
                        {
                            window.location.replace("../admin/admintable.php?page=main");
                        }
                        </script>
                        <div id="screenCover" style="display:none;">
                        <div id="popup">
                        <div id="closePopupMain">
                        <p id="closePopup"><a href="#">X</a></p>
                        </div>
                        <p id="success">Le menu à éte créer/modifiée!</p>
                        </div>
                        </div>';
                    }
                    else if($message = "changeSuccessEvent")
                    {
                        echo '
                        <script type="text/javascript">
                        $(document).ready(function()
                        {
                            $("#screenCover").slideToggle("slow");
                            $("#closePopup").click(function()
                            {
                                $("#screenCover").slideToggle("slow");
                                setTimeout(resetPage, 600);
                            });
                        });
                        function resetPage()
                        {
                            window.location.replace("../admin/admintable.php?page=main");
                        }
                        </script>
                        <div id="screenCover" style="display:none;">
                        <div id="popup">
                        <div id="closePopupMain">
                        <p id="closePopup"><a href="#">X</a></p>
                        </div>
                        <p id="success">L\'événement à éte créer/modifiée!</p>
                        </div>
                        </div>';
                    }

2 个答案:

答案 0 :(得分:2)

比较时应为./flow doctrine:migrate。您的==还可以,但在if中,您只有else-if,其中应该=,如果您的==是剩余的唯一条件,那么使用changeSuccessEvent代替else,如下所示:

else if

答案 1 :(得分:0)

确保下次您尝试比较使用 == 而不是 assign(=)

尝试以下

                $message = $_GET['message'];
                if($message == "changeSuccess")
                {
                    echo '
                    <script type="text/javascript">
                    $(document).ready(function()
                    {
                        $("#screenCover").slideToggle("slow");
                        $("#closePopup").click(function()
                        {
                            $("#screenCover").slideToggle("slow");
                            setTimeout(resetPage, 600);
                        });
                    });
                    function resetPage()
                    {
                        window.location.replace("../admin/admintable.php?page=main");
                    }
                    </script>
                    <div id="screenCover" style="display:none;">
                    <div id="popup">
                    <div id="closePopupMain">
                    <p id="closePopup"><a href="#">X</a></p>
                    </div>
                    <p id="success">La page à éte modifiée!</p>
                    </div>
                    </div>';
                }
                else if($message == "changeSuccessMenu")
                {
                    echo '
                    <script type="text/javascript">
                    $(document).ready(function()
                    {
                        $("#screenCover").slideToggle("slow");
                        $("#closePopup").click(function()
                        {
                            $("#screenCover").slideToggle("slow");
                            setTimeout(resetPage, 600);
                        });
                    });
                    function resetPage()
                    {
                        window.location.replace("../admin/admintable.php?page=main");
                    }
                    </script>
                    <div id="screenCover" style="display:none;">
                    <div id="popup">
                    <div id="closePopupMain">
                    <p id="closePopup"><a href="#">X</a></p>
                    </div>
                    <p id="success">Le menu à éte créer/modifiée!</p>
                    </div>
                    </div>';
                }
                else if($message == "changeSuccessEvent")
                {
                    echo '
                    <script type="text/javascript">
                    $(document).ready(function()
                    {
                        $("#screenCover").slideToggle("slow");
                        $("#closePopup").click(function()
                        {
                            $("#screenCover").slideToggle("slow");
                            setTimeout(resetPage, 600);
                        });
                    });
                    function resetPage()
                    {
                        window.location.replace("../admin/admintable.php?page=main");
                    }
                    </script>
                    <div id="screenCover" style="display:none;">
                    <div id="popup">
                    <div id="closePopupMain">
                    <p id="closePopup"><a href="#">X</a></p>
                    </div>
                    <p id="success">L\'événement à éte créer/modifiée!</p>
                    </div>
                    </div>';
                }