日期:2014-05-16 浏览次数:20306 次
<form onsubmit="return check(this)">
<input id="amount" name="amount" type="text" onblur="checkok(this.value)"><label style="color:Red;display:none" id="lbnote">内容不符合要求</label>
<input type="submit" id="subbt" value="提交"> </form>
<script>
function checkok(v) {
var ok = true;
if (!/^\d+$/.test(v)) ok = false;
else {
var i = parseInt(v, 10);
if (i > 5000
------解决方案--------------------
i % 50 != 0) ok = false;
}
document.getElementById('lbnote').style.display = ok ? 'none' : '';
return ok;
}
function check(f) {
if (!checkok(f.amount.value)) return false;
}
</script>