1
所以我試圖實現一個對話框,當用戶點擊我的頁面上的菜單按鈕時彈出,例如關於按鈕,它將顯示有關網頁的信息。所以,我已經爲上述實現了一個jquery函數和一個ascx頁面。asp.net web項目的JQuery對話框
$(document).ready(function() {
$('#aboutButton').click(function(event) {
alert("Thanks for visiting!");//testing
$(function() {
$("#aboutButtonDiv").load('aboutButton.ascx');
$("#aboutButtonDiv").dialog({
backdrop: 'static',
draggable: false,
position: {
my: "center top",
at: "center top+100",
of: window
},
dialogClass: "no-close",
resizable: false,
height: 'auto',
width: 500,
modal: true,
buttons: {
"OK": function() {
$(this).dialog("close");
}
}
})
})
})
$(".menu-close").hide();
});
我的ascx代碼是一個簡單的div標籤
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="aboutButton.ascx.cs" Inherits="WebProj.aboutButton" %>
<!DOCTYPE html>
<html>
<body>
<div id="aboutButtonDiv" title="About">
<p>Hello this is my first dialog using JQuery</p>
</div>
</body>
當我點擊按鈕的Click事件被解僱(我可以看到訪問消息的感謝),但該對話框我想要的不會彈出。我在jquery代碼中丟失了些什麼。在我的主頁面中,我有以下按鈕
<li class="menutab-list">
<a href="#" type="link" id="aboutButton" data-toggle="modal" data-target="#modalAbout">
<span class="listing-text">About</span>
</a>
</li>
我有以下腳本標記 仍不能正常工作 – user3324848
您是否也添加了'jquery-ui.css'? – VDWWD
,如果你想從另一個網站獲取它,你需要在腳本標籤中加入'http://'。 – VDWWD