2011-08-08 30 views
1

最近我開始使用jQuery,當試圖彈出使用jquery的模式表單時,它不會對我工作,CSS文件和JavaScript文件保留在本地。請參考下面Jquery模式表單不適用於我在PHP中工作

<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <title></title> 
    <script type="text/javascript" src="jquery.min.js"></script> 
<script type="text/javascript" src="jquery-ui.min.js"></script> 
<script type="text/javascript"> 
$(document).ready(function() { 
    var $dialog = $('<div></div>') 
     .html('This dialog will show every time!') 
     .dialog({ 
      autoOpen: false, 
      title: 'Basic Dialog' 
     }); 

    $('#opener').click(function() { 
       alert('test'); 
     $dialog.dialog('open'); 
     // prevent the default action, e.g., following a link 
     return false; 
    }); 
}); 
</script> 

</head> 
<body>   
    <?php 
     echo '<link rel="stylesheet" type="text/css" href="jquery-ui.css">'; 
    ?> 
    <button id="opener">Open the dialog</button> 

</body> 

的代碼片段,請糾正我,如果我沒有任何錯誤。謝謝大家。

+0

它的工作原理,如果你不使用PHP從服務器獲取代碼,並有一個單一的HTML頁面,而不是? –

+0

@Able這與PHP無關,順便說一句。 HTML,當然。 – Jordan

+0

所以,我需要使用以下鏈接:',對吧? –

回答

0

您需要包括:

modal: true, 

在你這樣的對話框定義:

var $dialog = $('<div></div>') 
    .html('This dialog will show every time!') 
    .dialog({ 
     autoOpen: false, 
     modal: true, 
     title: 'Basic Dialog' 
    }); 
+0

它不適合我... –

相關問題