在客户端处理文本框的onkeypress事件
给你个例子
<%@ Page language="c#"
AutoEventWireup="false"
codePage="936"%>
<HTML>
<HEAD>
<script>
functiondo
keypress()
{
var c=String.fromCharCode(event.keyCode);
if(c<'0' || c>'9')
event.keyCode=0;
}
</script>
</HEAD>
<body>
<form id="Form1"
method="post"
runat="server">
<asp:TextBox id="TextBox1"
runat="server"
onkeypress="dokeypress()"></asp:TextBox>
</form>
</body>
</HTML>