2012-04-05 15 views
0

我想打開一個對話框進行單擊按鈕確認。 對於我使用下面的代碼要包含哪個JS文件以使用對話框的功能

$('#dialog-box').dialog({ 
       show : 'drop', 

....

其中#對話框框是按鈕的ID。現在,我得到了一個錯誤: 遺漏的類型錯誤:對象的翻譯:有沒有一種方法「對話框」

哪個JS文件需要被包括在內,以便這個錯誤被刪除

+0

你需要發佈有#對話框的html部分 – 2012-04-05 08:08:21

回答

1

.dialog()功能部分JQuery UI

Here's a library from Google's CDN
爲了確保您獲得JQuery UI所需的所有內容,您可以從here 或從here使用其在線託管腳本下載它。

Here's a sample script

注中,我檢索庫,然後執行該腳本的命令:

  1. JQuery的
  2. JQuery用戶界面
  3. 初始化對話框
<!-- JQuery UI stylesheet --> 
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all" /> 

<!-- First get JQuery --> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 
<!-- Then get JQuery UI --> 
<script src="http://code.jquery.com/ui/1.8.18/jquery-ui.min.js"></script> 

<script> 
    $(function() { 
     $("#dialog-box").dialog({ 
      width: "auto", 
      height: "auto" 
     }); 
    }); 
</script> 

<div id="dialog-box" title="Getting down with dialog boxes"> 
    <p>This is how you initialize and use the dialog box.</p> 
</div> 
相關問題