0
现在!isValid不接受任何当前余额的输入值。是否有另一种方法来验证输入中的值? JSFiddle!isValid不接受来自输入的任何值
有问题的功能:
function isValid(entry, a, b)
{
if (isNaN(entry.value) || (entry.value==null) || (entry.value=="") || (entry.value < a) || (entry.value > b)) {
alert("Invalid entry. Your min payment should be between " + a + " and " + b + ".")
return false
}
return true
}
// send entries to validation function
// exit if not valid
if (!isValid(currentBalance, 0, 10000)) {
return false
} else if (!isValid(interest, 0, 30)) {
return false
} else {
return true;
}
if (!isValid(mnth_pay, currentBalance*.02, currentBalance)) {
return false
} else {
console.log("do nothing");
}