我有 javascript 可以在表单中使用,但是当我尝试将它放在内容上时不再起作用了..
这是工作的javascript:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Numeric.aspx.cs" Inherits="Numeric" %>
<!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="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="Scripts/jquery.numeric.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<form>
Numbers only:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input class="numeric" type="text" />
<script type="text/javascript">
$("#TextBox1").numeric();
</script>
</form>
</div>
</form>
</body>
</html>
并且内容中的javascript不起作用:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="NumericNew.aspx.cs" Inherits="NumericNew" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="Scripts/jquery.numeric.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server" > </asp:ScriptManager>
<div>
Numbers only:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input class="numeric" type="text" />
<script type="text/javascript">
$("#TextBox1").numeric();
</script>
</div>
</asp:Content>
请让我知道想法.. 谢谢。