In the following code blocks I don't see any affect that my java scipt is having on my form. Any ideas? Thanks.
Form:
if($row['password'] == $passwd)
{
echo "<html>";
echo "<body>";
echo "<script src='check.js'></script>";
echo "<form id='form1' action='changepassword.php' method='post'>";
echo "<table>";
echo "<tr><td>";
echo "New Password<center><input type='text' name='newpassword1'></td></tr></center>";
echo "<tr><td>";
echo "Re-Enter Password<center><input type='text' name='newpassword2'></td></tr></center>";
echo "<tr><td><input type='submit' value='submit' onclick='return validate(this.form,6,8)'></td></tr>";
echo "</table>";
echo "</form>";
echo "</body>";
echo "</html>";
}
Script:
function validate(form, minlength, maxlength)
{
var userInput = form.elements[0].value
if(userInput.length >= minlength && userInput.length <= maxlength)
{
return true;
}
else
{
alert("Please input between " + minlength + " and " + maxlength + " characters");
return false;
}