<script>
function isNumeric2(strNumber)
{
//只能是小数点两位
var newPar=/^(0)?(\.\d{2})?$/
alert(newPar.test(strNumber));
}
isNumeric2("0.25")
isNumeric2("0.255")
</script>
function isNumeric2(strNumber)
{
//只能是小数点两位
var newPar=/^(0)?(\.\d{2})?$/
alert(newPar.test(strNumber));
}
isNumeric2("0.25")
isNumeric2("0.255")
</script>
function ok(){
var re=/^\d{1,}(\.\d{1,2})?$/
var s=document.all.longstring.value
if(!re.test(s)){
alert('输入数据不符合')
return false
}
return true
}
</script><input name="longstring" type="text" class="input_2" size="27" ID="Text1" onblur="ok()">