Password Length and Email Validation using JavaScript

Password length
  1. function Pass_len(elem, helperMsg)   
  2. {  
  3.     if (pass1.value !== "" && pass2.value !== "")   
  4.     {  
  5.         if (pass1.value.length < 6)   
  6.         {  
  7.             strErrorMsg = strErrorMsg + helperMsg + "\n";  
  8.         }  
  9.         else   
  10.         {  
  11.         }  
  12.     }  
  13. }  
This code use for set password length in this code password length is if less then 6 then error accord.
 
Your password is to small.
 
Password length is 6 (1234567). (it's correct format)
 
Email Validation 
  1. function validateEmail(elem, helperMsg)   
  2. {  
  3.     if (elem.value !== "")   
  4.     {  
  5.         var email = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;  
  6.         if (!(elem.value.match(email)))  
  7.         {  
  8.             strErrorMsg = strErrorMsg + '' + helperMsg + "\n";  
  9.         }  
  10.     }  
  11. }  
This code in check email address if Your email is wrong then error accord.
 
Email Like: [email protected] (it's correct format)
 
Phone number validation 
  1. function ValidMno(elem, helperMsg)  
  2. {  
  3.     if (elem.value !== "")   
  4.     {  
  5.         var phone = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;  
  6.         if (!(elem.value.match(phone)))   
  7.         {  
  8.             strErrorMsg = strErrorMsg + '' + helperMsg + "\n";  
  9.         }  
  10.     }  
  11. }  
This code in check Mobile number if Your mobile number is wrong then error accord.
 
number Like: 9727899812 (it's correct format).
 
Thank You