//验证是否为正整数 function isPositiveInteger(s) { var re = /^[0-9]+$/; return re.test(s); } if (exchangeCount === "" || exchangeCount === "0" || Number(exchangeCount) === NaN || !isPositiveInteger(exchangeCount))// Number(exchangeCount) === NaN ,如果是非值类型返回值即为NAN
{ $("#ValidateExchangeCount").text("请输入正确的换货数量"); validateResult = false; } else
{ $("#ValidateExchangeCount").text(""); }