Validating Password in all Way using JavaScript

Here is the JavaScript code.
  1. <html>  
  2.     <head>  
  3.         <title>Password validation</title>  
  4.         <script language="javascript">  
  5. function CheckPassword()   
  6. {  
  7.     var pw = pass.pw.value;  
  8.     var cpw = pass.cpw.value;  
  9.     if (pw != cpw) window.alert("Re-enter your password");  
  10.     if (pw.length == 0)   
  11.     {  
  12.         alert("Please enter your password");  
  13.     }   
  14.     else if (pw.length < 3)   
  15.     {  
  16.         alert("Please enter aleast 3 characters password");  
  17.     }   
  18.     else if (pw == /^[A-Za-z]\w/)   
  19.     {  
  20.         alert("Your password first character must be a letter");  
  21.     }   
  22.     else if (pw == /^(?=.*[A-Z])/)   
  23.     {  
  24.         alert("Your password must contain atleast one uppercase letter");  
  25.     }   
  26.     else if (pw == /^(?=.*[a-z])/)   
  27.     {  
  28.         alert("Your password must contain atleast one uppercase letter");  
  29.     }  
  30.     else if (pw == /^(?=.*[0-9])/)   
  31.     {  
  32.         alert("Your password must contain atleast one numeric digit");  
  33.     }   
  34.     else if (pw == /^(?!.*\s)/)   
  35.     {  
  36.         alert("Your password must contain atleast one special character");  
  37.     }   
  38.     else window.alert("Your password is matched");  
  39. }  
  40.   
  41.         </script>  
  42.     </head>  
  43.     <center>  
  44.         <body font size=5 bgcolor="lightgreen" leftmargin=50 topmargin=50 >  
  45.             <Form id="pass" onSubmit="CheckPassword(this)" >  
  46. PASSWORD:                     
  47.            
  48.   
  49.                 <input type=password name="pw"size=10 max length=8 ></input>  
  50.                 <br>  
  51.                     <br>  
  52. CONFIRM PASSWORD              
  53.   
  54.                         <input type=password name="cpw"size=10 max length=8 ></input>  
  55.                         <br>  
  56.                             <br>  
  57.                                 <br>  
  58.                                     <input type="submit" name="sub" value="submit">      
  59.   
  60.                                         <input type="reset" name="rt" value="reset">  
  61.                                         </center>  
  62.                                     </body>  
  63.                                 </html>  
Thank you, keep learning and sharing