尝试学习 JavaScript,我想取得了不错的进步,但我一直在验证表单,试图查看是否有人有同样的问题,搜索没有出现任何问题。那你能帮帮我吗?
var minlength = 6;
var pwlength = document.getElementById('psswrd');
var invalid = " ";
function validate() {
if (pwlength.length < minlength && pwlength == invalid) {
alert("Password not valid");
else {
alert("Password okay!");
}
}
submitbtn.onClick = validate();