【发布时间】:2012-10-31 08:55:01
【问题描述】:
我在 javascript 中使用了一个 If 条件,
var iid = "c_poqty_"+itemid;
var calculatedQuantity = document.getElementById(iid).value;
if(! isNaN(actualQuantity)) {
if(actualQuantity >= calculatedQuantity) {
return true;
} else {
alert("You must enter the order qty same or greater than the calculated PO Qty");
document.getElementById(iid).focus();
return false;
}
} else {
alert("Please Enter valid number");
document.getElementById(iid).focus();
return false;
}
这里,calculatedQuantity 始终是浮点数,而 actualQuantity 可以是整数,
我有一个测试用例:
calculatedQuantity = 1.0
actualQuantity = 1
感谢您的帮助!
【问题讨论】:
标签: javascript integer