您的位置:首页 > 其它

用户注册 信息验证

2010-09-06 17:32 381 查看
代码

<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: