日期:2014-05-20 浏览次数:20433 次
<!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></title> <style type="text/css"> .style2 { width: 181px; } .style3 { width: 442px; } .style4 { width: 371px; } .style6 { width: 391px; } .style7 { color:Silver; } </style> <script type="text/javascript" > function checkEmail() { if (document.getElementById("email").value != "") { var emailValue = document.getElementById("email").value; if (emailValue != "") { if (!isEmail(emailValue)) { var visib = document.getElementById("CompareValidator2"); visib.innerText="邮件格式错误"; document.getElementById("email").focus(); return false; } else { var visib = document.getElementById("CompareValidator2"); visib.innerText = ""; return true; } } } } function isEmail(str) { var reg = /^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$/; return reg.test(str); } function Password_changed() { var pws = document.getElementById("Password1"); if (pws.value != "") { var txt1 = document.getElementById("Password1").value; } if (document.getElementById("Password2").value != "") { var txt2 = document.getElementById("Password2").value; } if (txt1 != txt2 != "") { document.getElementById("CompareValidator1").innerText = "两次密码不一致"; } else if (txt1 == txt2) { document.getElementById("CompareValidator1").innerText = ""; } } function Button2_Click() { document.getElementById("TextBox1").value=""; document.getElementById("Password1").value = ""; document.getElementById("Password2").value = ""; document.getElementById("Gender").selectitem=1; document.getElementById("TextBox6").value = ""; document.getElementById("email").value = ""; document.getElementById("yanzheng").value = ""; } </script> </head> <body runat="server"> <form id="form1" runat="server"> <cc2:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc2:ToolkitScriptManager> <center> <table style="width:72%;"> <tr> <td class="style3"> </td> <td class="style2" align="right"> <asp:Label ID="Label1" runat="server" Text="用户名:"></asp:Label> </td> <td align="right" class="style6"> <asp:TextBox ID="TextBox1" runat="server" Width="150px"></asp:TextBox> <cc2:TextBoxWatermarkExtender ID="TextBox1_TextBoxWatermarkExtender" runat="server" Enabled="True" TargetControlID="TextBox1" WatermarkText="请输入真实姓名" WatermarkCssClass="style7"> </cc2:TextBoxWatermarkExtender> </td> <td class="style4"> </td> </tr> <tr> <td class="style3"> </td> <td class="style2" align="right"> <asp:Label ID="Label3" runat="server" Text="密码:"></asp:Label> </td> <td align="right" class="style6"> <asp:TextBox ID="Password1" name="Password1" runat="server" Width="150px" TextMode="Password" onchange="Password_changed()"></asp:TextBox> <cc2:PasswordStrength ID="TextBox3_PasswordStrength" runat="server" PrefixText="强度:" TargetControlID="Password1"> </cc2:PasswordStrength> </td> <td class="style4" > <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="Password2" ForeColor="Red" SetFocusOnError="True"></asp:CompareValidator> </td> </tr> <tr> <td class="style3"> </td> <td class="style2" align="right"> <asp:Label ID="Label4" runat="server" Text="确认密码:"></asp:Label> </td> <td align="right" class="style6"> <asp:TextBox ID="Password2" runat="server" Width="150px" TextMode="Password" onchange="Password_changed()"></asp:TextBox> <cc2:PasswordStrength ID="TextBox4_PasswordStrength" runat="server" PrefixText="强度:" RequiresUpperAndLowerCaseCharacters="True" TargetControlID="Password2" BehaviorID="Password2_PasswordStrength"> </cc2:PasswordStrength> </td> <td class="style4"> </td> </tr> <tr> <td class="style3"> </td> <td class="style2" align="right"> <asp:Label ID="Label5" runat="server" Text="性别:"></asp:Label> </td> <td align="right" class="style6"> <asp:DropDownList ID="Gender" runat="server"> <asp:ListItem Value="0">男</asp:ListItem> <asp:ListItem Value="1">女</asp:ListItem> </asp:DropDownList> </td> <td class="style4"> </td> </tr> <tr> <td class="style3"> </td> <td class="style2" align="right"> <asp:Label ID="Label6" runat="server" Text="出生年月:"></asp:Label> </td> <td align="right" class="style6"> <asp:TextBox ID="TextBox6" runat="server" Width="150px"></asp:TextBox> <cc2:CalendarExtender ID="TextBox6_CalendarExtender" runat="server" Format="yyyy/MM/dd" TargetControlID="TextBox6"> </cc2:CalendarExtender> </td> <td class="style4"> </td> </tr> <tr> <td class="style3"> </td> <td class="style2" align="right"> <asp:Label ID="Label7" runat="server" Text="Email:"></asp:Label> </td> <td align="right" class="style6"> <asp:TextBox ID="email" runat="server" Width="150px" onchange="checkEmail()" ></asp:TextBox> </td> <td class="style4"> <asp:CompareValidator ID="CompareValidator2" runat="server" ForeColor="Red" ControlToValidate="email"></asp:CompareValidator> </td> </tr> <tr> <td class="style3"> </td> <td class="style2" align="right"> <asp:Button ID="Button1" runat="server" Text="注册" OnClick="Button1_Click1"/> </td> <td align="right" class="style6"> <asp:Button ID="Button2" runat="server" text="重置" OnClientClick="Button2_Click()" /> </td> <td class="style4"> </td> </tr> </table> </center> </form> </body> </html>