-1

如您所见,我对此很陌生。我有一个简单的代码,但由于某种原因,对话框永远不会进入屏幕中心,并且在 Safari 上不起作用。这是完整的代码。它仅在按下任何键时才开始消息。任何人都可以帮助我吗?

    <!doctype html>
     <html lang="en">
       <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

     <script  src="B:/wamp/www/jquery/js/jquery-1.8.2.js"></script>

       <link rel="stylesheet" href="B:/wamp/www/jquery/development-bundle/themes/base/jquery.ui.all.css">

       <script src="B:/wamp/www/jquery/development-bundle/external/jquery.bgiframe-2.1.2.js"></script>

     <script src="B:/wamp/www/jquery/development-bundle/ui/jquery.ui.core.js"></script>
     <script src="B:/wamp/www/jquery/development-bundle/ui/jquery.ui.widget.js"></script>
     <script src="B:/wamp/www/jquery/development-bundle/ui/jquery.ui.mouse.js"></script>
      <script src="B:B:/wamp/www/jquery/development-bundle/ui/jquery.ui.draggable.js"></script>
      <script src="B:B:/wamp/www/jquery/development-bundle/ui/jquery.ui.position.js"></script>
      <script src="B:/wamp/www/jquery/development-bundle/ui/jquery.ui.resizable.js"></script>
      <script src="B:/wamp/www/jquery/development-bundle/ui/jquery.ui.dialog.js"></script>
      <link rel="stylesheet" href="B:/wamp/www/jquery/development-bundle/demos/demos.css">

       <script >

          $(document).ready(function()
         {
         $("#text1").keyup(function()
    {
    $(function() {
    $( "#dialog-message" ).dialog({
        modal: true,
        buttons: {
            Ok: function() {
                $( this ).dialog( "close" );
            }
        }
    });
        });

        });
     });



     </script>
      <body>
         <div id="dialog-message"></div>

          <input type="text" id="text1"/>

      </body>
      </html>
4

1 回答 1

0

你有 jquery.ui.position.js,所以......

$( "#dialog-message" ).dialog({
    modal: true,
    position: 'center',
    buttons: {
        Ok: function() {
            $( this ).dialog( "close" );
        }
    }
});

...应该管用

于 2012-11-07T15:07:23.903 回答