Microsoft JScript中的运行时错误:测试是未定义 [英] microsoft jscript runtime error:test is undefined
问题描述
我有外面admin管理员ADN 1内2母版页1
I have 2 master pages 1 inside admin adn 1 outside admin
jQuery的管理外母版页功能射击特定事件和同样的功能,当我从该文件复制到adminmaster,I M越来越eror
jquery function outside admin master page is firing on specific event and same functions when I copied from that file to adminmaster , i m getting eror
Microsoft JScript中的运行时错误:'functionname'is未定义
microsoft jscript runtime error:'functionname'is undefined
这里的区别是管理大师有jQuery函数的内容页面,以及,只有那些功能都可以在viewsource页面或firefox-> firebug->剧本
The difference here is content page of admin master having jquery function as well , and only those functions are available in viewsource page or firefox->firebug->script
这是内部adminmasre的功能不可用的。
The function which are inside adminmasre are not available at all.
这是我的code为admin.master
here is my code for admin.master
<asp:ContentPlaceHolder ID="scriptadmin" runat="server">
<script type="text/javascript">
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = false;
});
$("#Logout").click(function (e) {
e.stopImmediatePropagation();
e.preventDefault();
});
function test() {
alert("Test");
}
function Dologout() {
// Sys.Services.AuthenticationService.logout(null, OnLogoutSuceeded, OnLoginFailed, null);
// return false;
}
// function OnLogoutSuceeded(result, userContext, methodName) {
// alert('You have been successfully logged out of the application...');
// // window.location.href("Login.aspx");
// }
</script>
</asp:ContentPlaceHolder>
</body>
</html>
和这里是DIV,我调用此函数
背部
登出
and here is div where I called this function Back Logout
内容页:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="XYZ.Admin.Default" MasterPageFile="~/Admin/admin.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h3 class="MainHeader">Upload Excel file to convert into database </h3>
<asp:Label ID="lblmsg" runat="server" Text="" CssClass="message" ></asp:Label>
<div class="file-upload-btn">
<asp:FileUpload ID="FileUpload1" runat="server" />
</div>
<div id ="ButtonWrapper" >
<asp:Button ID="btnUpload" runat="server" Text="Upload" data-role="none" onclick="btnUpload_Click" />
</div>
</asp:Content>
<asp:Content ID="script1" ContentPlaceHolderID="scriptadmin" runat="server">
<script type="text/javascript">
$(function () {
$("#btnUpload").removeClass('ui-btn-hidden ui-btn-inner ui-submit ui-btn ui-shadow ui-btn-corner-all ui-btn-up-b');
$("#FileUpload1").removeClass('ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c file-upload-btn');
});
</script>
</asp:Content>
任何帮助将是AP preciated !!
Any help would be appreciated!!
推荐答案
您已经取代了占位里面的code scriptadmin
,这就是为什么这些功能有消失了。
You've replaced the code inside the place holder scriptadmin
, that's why those functions have disappeared.
办法的ContentPlaceHolder
的工作是,如果他们继承的文件不具有的ContentPlaceHolder主文件中任何code仅运行。这是默认的内容,所以你要替换它。
The way ContentPlaceHolder
work inside Master pages is that any code inside the Master file is only run if they inheriting file doesn't have that ContentPlaceHolder. It's default content, so you're replacing it.
您需要做的是改变Admin.Master并改变它,因此的ContentPlaceHolder不包含默认的code,它总是代替补充说。
What you need to do is change the Admin.Master and change it so the ContentPlaceHolder doesn't contain the default code, it's always added instead.
<script type="text/javascript">
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = false;
});
$("#Logout").click(function (e) {
e.stopImmediatePropagation();
e.preventDefault();
});
function test() {
alert("Test");
}
function Dologout() {
// Sys.Services.AuthenticationService.logout(null, OnLogoutSuceeded, OnLoginFailed, null);
// return false;
}
// function OnLogoutSuceeded(result, userContext, methodName) {
// alert('You have been successfully logged out of the application...');
// // window.location.href("Login.aspx");
// }
</script>
<asp:ContentPlaceHolder ID="scriptadmin" runat="server" />
这篇关于Microsoft JScript中的运行时错误:测试是未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!