价格正则 if(!/^[0-9]+.[0-9]{0,2}$/.test(txtprice.value)) { alert("价格必须是数字,如有小数,保持两位!"); txtprice.focus(); return false; }