首先,我必须验证 id 和密码文本框不为空(那个正在工作)。然后我必须在相同的表单上验证文本框上的 id 需要是一个数字,并且也是一个介于 3000 和 3999 之间的数字(那个不起作用)。关于我的代码有什么问题的任何想法?
function validatefunctions() {
if (document.getElementById('idtb').value === '') {
alert('You need to enter a Customer ID');
return false;
}
if (document.getElementById('pwtb').value === '') {
alert('Please enter your password');
return false;
}
var custID;
custID = document.getElementsByName("idtb").valueOf();
if (custID !== isNan) {
alert("Customer ID needs to be numeric");
return false;
}
if (custID < 3000) {
alert("ID must be above 3000");
return false;
}
if (custID > 3999) {
alert("ID must be below …Run Code Online (Sandbox Code Playgroud)