Hi,
I am trying to learn Javascript and would appreciate some advice please. I tried to write a simple program to get the user to enter a password and when the button is pressed just check the length of the password to make sure its not less than 4 characters and not more than 8 characters and then output true or false in a text box.
It is not working can anyone help please.
<html>
<head>
<title>Untitled Document</title>
<SCRIPT>
function checkLength(aString)
{
return (aString.length >=4) && (aString.length <=8)
};
</SCRIPT>
</head>
<body>
<FORM NAME = “checker”>
Enter your Password
<INPUT NAME = “aString”
TYPE = “TEXT”
SIZE = 8
VALUE = ”>
<br>
<INPUT TYPE = “button”
VALUE = “Check Password”
ONCLICK = “document.checker.checked.value = function checkLength(document.checker.aString.value)”>
<br><br>
<INPUT NAME = “checked”
TYPE = “text”
VALUE = ”>
</FORM>
</body>
</html>