我正在尝试弹出一个模式,我知道这段代码有效,但由于某种原因,我的 js 要么没有加载,要么没有到达 $document.ready。我有一个警报,我在调试模式下运行,它甚至没有触发。
这是我的 .aspx 与加载 js 的脚本
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RCC_ChgPassTester.aspx.cs" Inherits="Regal.Web._Tester.RCC.RCC_ChgPassTester" %>
<%@ Register Src="RCC_ChangePassword.ascx" TagPrefix="Rcc" TagName="RCCChgPass" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="/assets/css/home.css" media="all" rel="stylesheet" type="text/css"/>
<link href="/assets/css/modal.css" media="all" rel="stylesheet" type="text/css"/>
<link href="/assets/css/rcc-main.css" media="all" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="http://www.regmovies.com/assets/css/jquery-plugins.css"/>
<!-- <link rel="stylesheet" href="/assets/css/global.css" /> -->
<script type="text/javascript" src="/assets/js/jquery.js"></script>
<script type="text/javascript" src="/assets/js/jquery-plugins.js"></script>
<script type="text/javascript" src="/assets/js/jquery.openCarousel.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
window.jQuery || document.write('<script type="text/javascript" src="/assets/js/jquery.js">\x3C/script>') /*]]>*/
</script>
<script type="text/javascript" src="../_assets/js/RCCTester.js"></script>
</head>
<body id="body" style="background-image:url(http://www.regmovies.com/~/media/Images/Site%20Takeovers/wallpaper_cloudyNP.ashx);">
<form id="form1" runat="server">
<div>
<RCC:RCCChgPass runat="server" ID="ChgPass" />
</div>
</form>
</body>
</html>
这是我的脚本:
(function (window) {
var
$ = window.jQuery,
modalLocation = '#modal-password-change',
modalPasswordChangeOpts = {
autoOpen: true,
modal: true,
resizable: false,
draggable: false,
width: '450',
height: '550',
dialogClass: 'modal',
close: function () { $(this).dialog('destroy'); }
};
function showModal() {
$(modalLocation).dialog($.extend(modalPasswordChangeOpts))
$(modalLocation).dialog('open');
}
$(document).ready(function () {
RCC.showModal();
alert("I am here");
return false;
});
window.RCC = window.RCC || {};
window.RCC.showModal = showModal;
});