var extReg2 = /^\d+(\.\d+)?$/;
if(et_price==""){
alert('您还未填写市场售价!');
return false;
}
if(!et_price.match(extReg2)){
alert('市场售价必须是数字!');
return false;
}
if(et_price==""){
alert('您还未填写市场售价!');
return false;
}
if(!et_price.match(extReg2)){
alert('市场售价必须是数字!');
return false;
}
-----------------------------
http://www.pkwutai.cn
<head><script>function check()
{
if(document.getElementById("txt").value.match("^[0]$|^[0][.]\\d{1,2}$|^[1-9]{1}\\d{0,11}$|^[1-9]{1}\\d{0,11}[.]\\d{1,2}$"))
{alert("success");}
else{alert("failure");}
}</script></head>
<body>
<form name="theform">
<input type="text" id="txt"><input type="button" onClick="check();" value="submit">
</form>
</body></html>