我一直在尝试从中调用 JQuery 代码,Button1
但是每当我单击该按钮时,什么都没有发生。我怀疑这里缺少一些东西。
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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="Scripts/jquery-1.4.1.js"/>
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"/>
<script type="text/javascript">
$(document).ready(function(){
$("#Button1").click(function () {
alert("Hello");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>
请帮助我,因为我是 ASP 的 Jquery 新手
更新!呈现的 HTML
<!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><title>
</title>
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"/>
<script type="text/javascript">
$(document).ready(function () {
$("#B1").click(function () {
alert("Hello");
});
});
</script>
</head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1" enctype="multipart/form-data">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTExNzQxODc4NzgPZBYCAgMPFgIeB2VuY3R5cGUFE211bHRpcGFydC9mb3JtLWRhdGEWAgITDzwrAA0AZBgBBQlHcmlkVmlldzEPZ2S859s2HXOd3dMN1a3AFBBA24YTWA==" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBwLCh8GMCAKl1bK4CQK1qbSRCwKM54rGBgK7q7GGCALWlM+bAgLe7+btDB1tn9tYIpN00SJIvx3i3VxCTOP7" />
</div>
<input type="submit" name="B1" value="Button" id="B1" />
</form>
</body>
</html>