请指导我在以下程序中声明静态变量。我想通过单击按钮来增加静态变量 lists.counter 的值。但它不起作用。
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="finalspecific2_list._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function lists() {
var list = $('#myList li:gt(0)');
list.hide();
lists.counter = 0;
var username = $("#<%= uname.ClientID %>").val();
var pwd = $("#<%= pwd.ClientID %>").val();
$("#<%= Login.ClientID %>").click(function () {
lists.counter++;
alert(lists.counter);
lists.counter++;
});
$("#<%= Button1.ClientID %>").click(function () {
{
alert(lists.counter);
}
});
});
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:Button ID="Login" runat="server" Text="Login" />
<asp:Button ID="Button1" runat="server" Text="Login" />
</ul>
</asp:Content>
当单击任何按钮时,lists.counter 应该增加,并且应该在随后的点击中增加。请指导此事。