用户注册 信息验证

 

ContractedBlock.gif ExpandedBlockStart.gif 代码
 
   
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head runat ="server" >
< title > 注册验证 </ title >
< style type ="text/css" >
.body
{
margin
: 0 ;
padding
: 0 ;
text-align
: center ;
}
.div_cont
{
margin
: 0 auto ;
padding
: 0 ;
width
: 500px ;
}
.tab_theme
{
font-size
: 15px ;
text-align
: left ;
font-weight
: bold ;
}
.tab_martop
{
margin-top
: 10px ;
}
.tab_control
{
font-size
: 13px ;
text-align
: left ;
}
.td_light
{
line-height
: 25px ;
}
.td_left
{
width
: 100px ;
text-align
: left ;
}
.td_right
{
width
: 300px ;
padding-right
: 6px ;
}
</ style >
</ head >
< body >
< form id ="form1" runat ="server" >
< div class ="div_cont tab_martop" >
< table class ="tab_theme tab_martop" cellpadding ="0" cellspacing ="0" >
< tr >
< td >
验证不为空:
</ td >
</ tr >
</ table >
< table class ="tab_control" cellpadding ="0" cellspacing ="0" >
< tr >
< td class ="td_left td_light" >
用户名:
</ td >
< td class ="td_right td_light" >
< asp:TextBox ID ="txt_name" runat ="server" Width ="100%" ></ asp:TextBox >
</ td >
</ tr >
< tr >
< td class ="td_left" >

</ td >
< td class ="td_right" >
< asp:RequiredFieldValidator ID ="rfv_name" runat ="server" ControlToValidate ="txt_name"
Display
="Dynamic" ErrorMessage ="用户名不能为空!" ></ asp:RequiredFieldValidator >
</ td >
</ tr >
</ table >

< table class ="tab_theme tab_martop" cellpadding ="0" cellspacing ="0" >
< tr >
< td >
指定正则表达式的验证:
</ td >
</ tr >
</ table >
< table class ="tab_control" cellpadding ="0" cellspacing ="0" >
< tr >
< td class ="td_left td_light" >
Email:
</ td >
< td class ="td_right td_light" >
< asp:TextBox ID ="txt_email" runat ="server" Width ="100%" ></ asp:TextBox >
</ td >
</ tr >
< tr >
< td class ="td_left" >

</ td >
< td class ="td_right" >
< asp:RegularExpressionValidator ID ="rev_email" runat ="server" ControlToValidate ="txt_email"
Display
="Dynamic" ValidationExpression ="^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" ErrorMessage ="电邮地址的格式不正确!" ></ asp:RegularExpressionValidator >
</ td >
</ tr >
</ table >

< table class ="tab_theme tab_martop" cellpadding ="0" cellspacing ="0" >
< tr >
< td >
所填写内容不能是指定内容:
</ td >
</ tr >
</ table >
< table class ="tab_control" cellpadding ="0" cellspacing ="0" >
< tr >
< td class ="td_left td_light" >
城市:
</ td >
< td class ="td_right td_light" >
< asp:DropDownList ID ="drop_city" runat ="server" Width ="200px" >
< asp:ListItem Text ="请选择..." ></ asp:ListItem >
< asp:ListItem Text ="北京" ></ asp:ListItem >
< asp:ListItem Text ="天津" ></ asp:ListItem >
</ asp:DropDownList >
</ td >
</ tr >
< tr >
< td class ="td_left" >

</ td >
< td class ="td_right" >
< asp:CompareValidator ID ="cv_maxdeg" runat ="server" ControlToValidate ="drop_city"
Display
="Dynamic" Type ="String" Operator ="NotEqual" ValueToCompare ="请选择..." ErrorMessage ="请选择城市!" ></ asp:CompareValidator >
</ td >
</ tr >
</ table >

< table class ="tab_theme tab_martop" cellpadding ="0" cellspacing ="0" >
< tr >
< td >
验证两个textbox的内容是否相同:
</ td >
</ tr >
</ table >
< table class ="tab_control" cellpadding ="0" cellspacing ="0" >
< tr >
< td class ="td_left td_light" >
密码:
</ td >
< td class ="td_right td_light" >
< asp:TextBox ID ="txt_pwd" runat ="server" Width ="100%" TextMode ="Password" ></ asp:TextBox >
</ td >
</ tr >
< tr >
< td class ="td_left td_light" >
再次输入密码:
</ td >
< td class ="td_right td_light" >
< asp:TextBox ID ="txt_entpwd" runat ="server" Width ="100%" TextMode ="Password" ></ asp:TextBox >
</ td >
</ tr >
< tr >
< td class ="td_left" >

</ td >
< td class ="td_right" >
< asp:CompareValidator ID ="cv_pwd2" runat ="server" ControlToCompare ="txt_pwd" ControlToValidate ="txt_entpwd"
ErrorMessage
="两次输入的密码不正确!" ></ asp:CompareValidator >
</ td >
</ tr >
</ table >

< table class ="tab_control" cellpadding ="0" cellspacing ="0" >
< tr >
< td class ="td_left" >

</ td >
< td class ="td_right" style ="text-align:right;" >
< asp:Button ID ="Button1" runat ="server" Text ="提交" />
</ td >
</ tr >
</ table >
</ div >
</ form >
</ body >
</ html >

 

 

转载于:https://www.cnblogs.com/infim/archive/2010/09/06/1819513.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值