Right, just need one piece of advice if anyone is able to help??
When I run the above code, and enter a VALID password it shows the alert as below, however, if the password is NOT valid the code just seems to get lost and then I have to close IE.
Does anyone know how I can get past
Code:
if (intValidPassword = 1);
alert("Your password is valid!")
and then back to the top if the password is invalid?
Thanks
Code:
<script language = "JavaScript">
function validatePassword()
{
//Declare and initilise variables
var intIncludesAt = 0; //Changes to 1 if an @ sign is found
var intValidPassword = 0;
var intIncludesAt = 0;
var strPassword = prompt("Please enter a valid password","");
var intFirstChar = parseInt(strPassword.charAt(0)); //First character of the password
while(intValidPassword == 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>