Hello,
I think I nearly have this figured out,
however, what i'd like to do is to check and see if both passwords entered are the same. If they are not what i'd like to do is ask the user to re-enter the new one and confirm the second password again. My current code alerts the user that their passwords do not match and does not ask them to enter the new one and confirm the other password again. Any ideas as to how to loop it until both passwords match?
I think I nearly have this figured out,
however, what i'd like to do is to check and see if both passwords entered are the same. If they are not what i'd like to do is ask the user to re-enter the new one and confirm the second password again. My current code alerts the user that their passwords do not match and does not ask them to enter the new one and confirm the other password again. Any ideas as to how to loop it until both passwords match?
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/javascript">
function test() {
var pwd = prompt("Enter a new pwd","")
var pwd2 = prompt("Re-enter new pwd","")
if(pwd != pwd2) {
alert('Your passwords do not match. Please type again.');
return false;
}
return true;
}
</script>
</head>
<body onload="test()">
</body>
</html>
Comment