0

我正在使用 jquery UI 创建一个弹出窗口作为警报消息,当单击它以调用并获取另一个页面时,我需要 t 制作 ok 按钮有人可以帮助我吗????

这是代码

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>jQuery UI Dialog - Modal message</title>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <!--<link rel="stylesheet" href="/resources/demos/style.css" />!-->

        <script>
            $(function() {
                $("#dialog-message").dialog({
                    modal : true,
                    buttons : {
                        enter : function() {
                            $(this).dialog("close");
                        }
                    }
                });
            });
        </script>
    </head>
    <body>
        <div id="dialog-message" title="WIN  PRICES" style="width:300px; height:150px;">
            <p>
                <!--<span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>!-->
                <span style ="float: left; margin:0 7px 50px 0;"><img src="b4l.jpg" width="77" height="53"></span>
                <h3>byu for less</h3>
                Shoping online <b>Need No Password</b>
                <br>
                Get your needs is our job.
            </p>
            <p>
                <b>every week win a price</b>.
            </p>
        </div>
        <p>
            Sed vel diam id libero <a href="http://example.com">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.
        </p>
    </body>
</html>
4

2 回答 2

0

您可以创建自定义警报框,以便对其进行自定义以满足您的需求。

看看这里,因为这将帮助您选择更适合您的东西。

PS:你也可以试试下面的。

HTML

<input type="button" onclick="confirmation()" value="Want to go to google?">

JS

function confirmation() {
    var answer = confirm("Want to go to google?");
    if (answer){
        alert("Bye bye!");
        window.location = "http://www.google.com/";
    }
    else{
        alert("Thanks for sticking around!");
    }
}
于 2013-09-11T23:14:26.363 回答
0

不确定您所说的“调用并获取另一个页面”是什么意思——这可行吗?

在这里工作 jsFiddle

<html>
    <head>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />

        <script type="text/javascript">
            $(document).ready(function() {

                $( "#dialog-message" ).dialog({
                    modal: true,
                    buttons: {
                        enter: function() {
                            $( this ).dialog( "close" );
                            window.location.href='http://google.com';
                        }
                    }
                });

            }); //END $(document).ready()

        </script>
    </head>
<body>

    <div id="dialog-message">
        <h1>Example Dialog</h1>
        <img src="http://placehold.it/150x150" width="150" height="150"/>
        First Name: <input type="text" id="fname"><br />
        Last Name: <input type="text" id="lname"><br />
    </div>

</body>
</html>
于 2013-09-11T23:16:05.060 回答