//驗證是否爲正整數 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(""); }