我是一个完整的jQuery noob,我正在尝试在ASP.Net网页中使用Eric Martin's SimpleModal Confirm Override dialog box。它不起作用 - 毫不奇怪,我不知道我在做什么!这是我的aspx页面的简化版本:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Reimbursements.aspx.cs" Inherits="EAS.telecom.Reimbursements" MasterPageFile="~/common/default.master" Title="Reimbursements" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ MasterType VirtualPath="~/common/default.master" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript' src='~/jquery/confirm/js/jquery.js'></script>
<script type='text/javascript' src='~/jquery/confirm/js/jquery.simplemodal.js'>
$.modal('#confirm');</script>
<script type='text/javascript' src='~/jquery/confirm/js/confirm.js'></script>
<script language="javascript" type="text/javascript">
//some regular javascript here
</script>
<asp:Panel runat="server" ID="pnlEmployeeInfo" Enabled="false">
<div id='content'>
<div id='confirm-dialog'>
<h3>Confirm Override</h3>
<p>A modal dialog override of the JavaScript confirm function. Demonstrates the use of the <code>onShow</code> callback as well as how to display a modal dialog confirmation instead of the default JavaScript confirm dialog.</p>
<input type='button' name='confirm' class='confirm' value='Demo'/> or <a href='#' class='confirm'>Demo</a>
</div>
<!-- modal content -->
<div id='confirm'>
<div class='header'><span>Confirm</span></div>
<div class='message'></div>
<div class='buttons'>
<div class='no simplemodal-close'>No</div><div class='yes'>Yes</div>
</div>
</div>
<!-- preload the images -->
<div style='display:none'>
<img src='~/jquery/confirm/img/confirm/header.gif' alt='' />
<img src='~/jquery/confirm/img/confirm/button.gif' alt='' />
</div>
</div>
//more controls, including an AJAX TabContainer
</asp:Panel></asp:Content>
当我运行页面时,我看到Demo按钮和Demo链接,但点击它们什么都不做。我错过了什么?我可以在ASP.Net页面上使用SimpleModal吗?在内容控件中?非常感谢!
答案 0 :(得分:0)
这里有多个问题。
带有script
的{{1}}标记也不能包含脚本正文。所以,这是无效的。
src
如果您使用ID,则会调用SimpleModal,如下所示:<script src='~/jquery/confirm/js/jquery.simplemodal.js'>$.modal('#confirm');</script>
该调用需要在单击事件处理程序中。
$('#content').modal();