2012-01-30 121 views
1

我想知道我需要做的只是一個基本的jQuery對話框出現在屏幕上。以下是我的代碼如下。任何幫助爲什麼在執行下面的代碼時,沒有任何UI屬性被渲染?目前發生的所有情況是,如果用戶單擊「顯示對話框」,則會顯示純HTML文本,而不顯示任何UI CSS或實際對話框。我已經包含了從http://jqueryui.com/download下載的jQuery UI腳本,但也許我沒有下載並使用正確的UI腳本?謝謝!如何使用jQuery UI對話框

母版頁代碼:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 
<head runat="server"> 
<title></title> 
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" /> 

<script type="text/javascript" src="Scripts/jquery-1.7.1.min.js"></script> 
<script src="Scripts/UI/css/ui-lightness/jquery-ui-1.8.17.custom.css"  type="text/javascript"></script> 
<script src="Scripts/UI/js/jquery-ui-1.8.17.custom.min.js" type="text/javascript"></script> 
<asp:ContentPlaceHolder ID="HeadContent" runat="server"> 
</asp:ContentPlaceHolder> 
</head> 
<body> 
    <form runat="server"> 
<div class="page"> 
    <div class="main"> 
     <asp:ContentPlaceHolder ID="MainContent" runat="server"/> 
    </div> 
</div> 
</form> 
</body> 
</html> 

默認頁面:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" 
CodeFile="Default.aspx.cs" Inherits="_Default" %> 

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> 
<script src="Scripts/textboxclone.js" type="text/javascript"></script> 
<script src="Scripts/fadeOut.js" type="text/javascript"></script> 
<script src="Scripts/flip.js" type="text/javascript"></script> 
<script src="Scripts/dialog.js" type="text/javascript"></script> 

</asp:Content> 
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">  
<a id='showDialog' href="#">Show Dialog</a> 
<div id="dialog1" style="display:none;"> 
<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> 
</div> 
</asp:Content> 

回答

6

你必須包括jQuery的CSS文件作爲一個CSS文件。使用

<link rel="Stylesheet" 
     href="Scripts/UI/css/ui-lightness/jquery-ui-1.8.17.custom.css" /> 

,而不是

<script src="Scripts/UI/css/ui-lightness/jquery-ui-1.8.17.custom.css" 
     type="text/javascript"></script> 
+0

這解決了我的問題!我所要做的就是修改上面提到的JQuery CSS文件的確切代碼作爲CSS文件。謝謝!! – jre247 2012-01-30 21:25:31