View Single Post
  #2  
Old 09-05-2009
c0sie c0sie is offline
*SuPeRsTaR mEmBeR*
 
Join Date: Feb 2006
Location: Cheltenham
Posts: 3,294
Default

So anyways...

This is where im at now:

Code:
<script language = "JavaScript">

//Declare and initilise variables
	var intIncludesAt = 0; //Changes to 1 if an @ sign is found
	var intFirstChar; //First character of the password
	var intValidPassword = 0; 
	var intIncludesAt = 0;

	function validatePassword()
	{
		var strPassword = prompt("Please enter a valid password","");
		
		while(intValidPassword == 0)
		{ 	
			intFirstChar = parseInt(strPassword.charAt(0));
		
			for (intCount = 0; intCount < strPassword.length; intCount ++)
			{
				if(strPassword.charAt(intCount) == "@")
				{
					intIncludesAt = 1;
				}
			}
		
			if (strPassword.length >= 6 && intIncludesAt == 1 && intFirstChar == 0) 
			{
				intValidPassword = 1;
			}
		}			
		
		if (intValidPassword = 1);
			alert("Your password is valid!")
	}
</script>
The problem im getting now is that if I enter any password at all it says that the password is valid...but if I enter nothing and press the button it slows IE8 and shows an error relating to IE8 :/
__________________
Previously:
BRCA Micro Section Chairman.
BRCA Micro National Champion.

Currently:
JQ fan.
Bellend.

Forums are better than Facebook groups
Reply With Quote