javascript价格判断代码

日期:2014-11-26 分类:网络技术 浏览:6569 来源:邦明科技


<script type="text/javascript">
function productcheck(){
  var priceen=document.productsedit.priceen.value;
  var pricech=document.productsedit.pricech.value;
  var patrn=/^(([0-9]+[\.]?[0-9]+)|[1-9])$/;
  if(pricech=="" || pricech==null){
      alert("中文价格不能为空");
      document.productsedit.pricech.focus();
          return false;
  }
  if(!patrn.exec(pricech)){
      alert("中文价格必须为正数");
      document.productsedit.pricech.focus();
    &nbasp;     return false;
  }
  if(priceen=="" || priceen==null){
      alert("英文价格不能为空");
      document.productsedit.priceen.focus();
          return false;
  }
  if(!patrn.exec(priceen)){
      alert("英文价格必须为正数");
      document.productsedit.priceen.focus();
          return false;
  }
 
}
</script>



上一篇: CSS导航下拉菜单被JS幻灯片挡住的解决办法

下一篇: PHP explode函数乱码问题解决方法


QQ客服

客服微信