我有一個asp.net應用程序,並在右上角我想顯示「聯繫我們」鏈接。點擊這個鏈接按鈕後,應該打開一個彈出窗口,並且休息區應該變灰。DialogBox代碼主頁
現在,要在所有應用頁面中顯示聯繫我們,必須將其添加到母版頁。下面是我試圖修改的母版代碼,但不知何故對話框沒有打開。由於放置div。有人可以引導我嗎?
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="mstMainPage.master.cs"
Inherits="TestProj.Master.mstMainPage" %>
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../CSS/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<style>
.ui-widget-header,.ui-state-default, ui-button{
background:#b9cd6d;
border: 1px solid #b9cd6d;
color: #FFFFFF;
font-weight: bold;
}
</style>
<script language="javascript" type="text/javascript">
$(function(){
$("#btnContactUs").click(function() {
($("#dialog-5").dialog("isOpen") == false) ? $("#dialog-5").dialog("open") : $("#dialog-5").dialog("close") ;
});
$("#dialog-5").dialog({autoOpen: false});
});
function CloseWindow() {
window.close();
}
</script>
</head>
<body style="margin-top: -5px; margin-left: -5px; margin-right: 0px; border-color: #79ACCA; border-width">
<form id="form1" runat="server">
<div>
<!-- Main Panel -->
<asp:Panel ID="Panel2" runat="server" Width="100%" Style="margin-left: 0px">
<asp:Table runat="server" ID="tab1" Width="100%">
<asp:TableRow>
<asp:TableCell Height="28px" Width="100%" BackColor="#79ACCA" HorizontalAlign="Right">
<asp:Button ID="btnContactUs" runat="server" Text="Contact Us" >
</asp:Button>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:Panel>
<asp:Panel runat="server" CssClass="ContentMargin">
<asp:ContentPlaceHolder ID="cphMSTMainPage" runat="server">
</asp:ContentPlaceHolder>
</asp:Panel>
<div id="dialog-5" title="Dialog Title!">
Click on the Toggle button to open and close this dialog box.
</div>
</div>
</form>
</body>
</html>
,能得到任何異常中? –
不。當我點擊聯繫我們時,它只是重新加載頁面。 – user1630575
將警報消息放在按鈕單擊並檢查您的按鈕單擊是否正常工作。 –