在母版页中使用$ .noConflict时出现jquery问题

时间:2011-03-28 11:54:34

标签: .net master-pages jquery

我曾在单页试过这个。我工作。但我在母版页(dotnet)中尝试这个,没有用。 你能说出这个问题吗?

============== aaaaaaaaaaaaaaaa.master页面

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="aaaaaaaaaaaaaaaa.master.cs" Inherits="aaaaaaaaaaaaaaaa" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title></title>
  <script type='text/javascript' src="javascripts/jquery.min.js">
  </script><script language="javascript" type="text/javascript">
    $.noConflict();
  </script>
  <asp:ContentPlaceHolder id="head" runat="server">
  </asp:ContentPlaceHolder>
</head>
<body>
  <form id="form1" runat="server">
    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>
  </form>
</body>
</html>

============== bbbbbbbbbbbbbbbbbbbbb.aspx page

<%@ Page Title="" Language="C#" MasterPageFile="~/aaaaaaaaaaaaaaaa.master" AutoEventWireup="true" CodeFile="bbbbbbbbbbbbbbbbbbbbbb.aspx.cs" Inherits="bbbbbbbbbbbbbbbbbbbbbb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
  <script language="javascript" type="text/javascript">
    function goster() {
        alert(jQuery("#TextBox1").val());
    }
  </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  <asp:TextBox ID="TextBox1" onBlur="goster();" runat="server"></asp:TextBox>
</asp:Content>

1 个答案:

答案 0 :(得分:0)

感谢@Mahesh。这个问题的答案是;

in bbbbbbbbbbbbbbbbbbbbbb.aspx page

       function goster(){         警报(jQuery的( “#ContentPlaceHolder1_TextBox1”)VAL());     }