日期:2014-05-18  浏览次数:20481 次

csdn高手们 帮我看看 啊 嘿嘿!
我用正规表达式校验密码和重复密码遇到问题了,我是用控件校验,现在还没有办法解决!
<asp:Content   ID= "Content2 "   ContentPlaceHolderID= "MainContent "   Runat= "Server ">
<script   language= "javascript "     type   = "text/javascript ">
function   isPasswd(sTextId)   {  
        alert(sTextId);
        var   s   =document.all. "+   TextBox2.ClientID   +@ ".value;
        //   s   =   document.getElementById( "TextBox2 ");
     
var   patrn=/^(\w){6,20}$/;  
if   (!patrn.exec(s))  
{
       
        return   false;
}
else
{
        return   true;
}
}  


</script>
<table   width= "100% ">                    
<tr   class= "ta ">
      <td   class= "td "   align= "right "> <asp:Label   ID= "Label1 "   runat= "server "   Text= "用户名称: "   > </asp:Label> </td>
        <td   width= "75% "   class= "td "   > <font   color= "red "> <asp:TextBox   ID= "TextBox1 "   runat= "server "   MaxLength= "150 "   Width= "160px "> </asp:TextBox> <asp:RequiredFieldValidator   ID= "TextBox1Required "   runat= "server "   ControlToValidate= "TextBox1 "
                                                                                        ErrorMessage= "User   Name   is   required. "   ToolTip= "User   Name   is   required. "   > *请输入用户名 </asp:RequiredFieldValidator>
            </font>        
    </td> </tr>

<tr   class= "tb ">
        <td   class= "td "   align= "right "> <asp:Label   ID= "Label2 "   runat= "server "   Text= "用户密码: "> </asp:Label> </td>
        <td   class= "td ">
                <asp:TextBox   ID= "TextBox2 "  
                          runat= "server "   MaxLength= "50 "   TextMode= "Password "   Width= "160px "> </asp:TextBox>  
                          <font   color= "red "> [6-20位] </font>
                          <asp:RequiredFieldValidator   ID= "TextBox2Required "   runat= "server "