0

私はjavascriptが初めてで、ページが開いたときに簡単なダイアログを開こうとしていますが、単に表示されるだけです

ダイアログのテキストは、通常の段落であり、ダイアログはありません。これが私のindex.htmlです:

<html xmlns=\ "http://www.w3.org/1999/xhtml\" xml:lang=\"en\">
<head>
  <META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
  <script type='text/javascript' src='js/jquery.js'></script>
  <title>Welcome to Jetty-9</title>
  <style type="text/css" title="maincss">
    @import url(maincss.css);
  </style>
  <script type="text/javascript">
    $(function() {
      $("#dialog").dialog();
    });
  </script>
</head>
<body>

  <div id="dialog" title="Basic dialog">
    <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
  </div>

</body>
</html>

そして、私の maincss.css は、本文に背景画像を配置するだけで、js/jquery.js ファイルは jquery の最新バージョンであり、ページをロードし、ページのソースを表示してから開くことで、正しくリンクされていることを確認しましたjsファイルをクリックして

4

5 に答える 5

0

jQuery UI がありません。以下のコードをheadページに含めます。

<link href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/black-tie/jquery-ui.min.css' rel='stylesheet' />
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'></script>

jquery ui とそのテーマのさまざまなバージョンの CDN リンクについては、こちらをご覧ください。

于 2013-07-01T18:23:25.223 に答える