控制文本框输入

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebLibrary.JS.控制输入.WebForm1" %>
<!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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    输入数字<asp:TextBox ID="txtNumber" runat="server" onkeypress="if (event.keyCode < 48||event.keyCode >57) event.returnValue = false;"></asp:TextBox>
    <br />
    输入字母<asp:TextBox ID="txtLetter" runat="server" onkeypress="if (event.keyCode < 65||event.keyCode >123) event.returnValue = false;"></asp:TextBox>
    </div>
    </form>
</body>
</html>
posted @ 2011-02-11 16:04  TNTZWC  阅读(...)  评论(...编辑  收藏