home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 November / PCWNOV07.iso / shared / regwiz.cab / RegWizUI.dll / HTML / VALIDATION.JS < prev   
Encoding:
Text File  |  2005-07-13  |  1.9 KB  |  79 lines

  1. function RemoveSpaces(str)
  2. {
  3.     var strTemp=new String(str);
  4.     //Use regular expressions to remove white-spaces in string
  5.     return(strTemp.replace(/\s*/g,""));
  6. }
  7.  
  8.         
  9. function CheckEmail(strEmail)
  10. {
  11.     var intEmailTest1,intEmailTest2,blnIsEmailValid;
  12.     var newString;
  13.  
  14.     //Check email for spaces and remove them
  15.     //Use regular expressions to remove the spaces
  16.     strEmail=RemoveSpaces(strEmail);
  17.  
  18.     //Validate email address
  19.     newString = strEmail.match(/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/);
  20.     if (!newString)
  21.         return(false);
  22.     else 
  23.         return(true);
  24. }
  25.  
  26. function CheckPassword(strPassword)
  27. {
  28.     var strTemp=new String(strPassword);
  29.     var intTemp=strTemp.length;
  30.         
  31.     //Checking whether the password is 4 to 50 characters in length
  32.     if (Math.abs(intTemp-27)<=23)
  33.         return(true);
  34.     else
  35.         return(false);
  36. }
  37.  
  38. function blnCheckUserID(strUserID)
  39. {
  40.     //Check whether @ is there in the UserID (it should NOT be there).
  41.     var objUserID=new String(strUserID)
  42.     var intPosition=objUserID.indexOf("@");
  43.     
  44.     //If it is not there, -1 is returned, which is what we want.
  45.     return (intPosition==-1);
  46. }
  47.  
  48. function CheckFields(strValue)
  49. {
  50.    if (strValue == "")
  51.         return(false);
  52.    else
  53.         return(true);
  54. }
  55.  
  56.  
  57.  
  58. function openNoScrollWindow_1(url,title,width,height)
  59. {
  60.         var strFeatures = "toolbar=no,scrollbars=yes,menubar=no,location=no,directories=no,status=yes,resizable=yes";
  61.  
  62.         var x = screen.width;
  63.         var y = screen.height;
  64.  
  65.         var top = parseInt((y-height)/2);
  66.         var left = parseInt((x-width)/2);
  67.  
  68.         // open new window and use the variables to position it
  69.  
  70.         window.parent.closed
  71.  
  72.         var objWindow = window.open(url,title,'width='+width+',height='+height+',left='+left+',top='+top+',scrollbars=yes,resize=yes,resizable=yes,menubar=no,toolbar=no,directories=no');
  73.         return objWindow;
  74. }
  75.  
  76.  
  77.  
  78.  
  79.