引用值与对文本的规范要求(正则表达式)

<script type="text/javascript">
     function product()
      {
         var url="../Product/Product_Windows.aspx";
         var result=window.showModalDialog(url,'dialogWidth:590px;status:no;dialogheight:500px');
         if(result != null)
         {
            var val =result.split(',');
            document.getElementById("ProductID").value=val[0];
          document.getElementById("ProductName").value=val[1];
         }
    }
    function Supplier()
    {
      var url="../Product/Supplier_Windows.aspx";
      var result=window.showModalDialog(url,'dialogWidth:590px;status:no;dialogheight:500px');
         if(result != null)
         {
            var val =result.split(',');
            document.getElementById("SupplierID").value=val[0];
            document.getElementById("SupplierName").value=val[1];
         }
    }
    function Employee()
    {
      var url="../Product/Employee_Windows.aspx";
      var result=window.showModalDialog(url,'dialogWidth:590px;status:no;dialogheight:500px');
         if(result != null)
         {
            var val =result.split(',');
            document.getElementById("EmployeeID").value=val[0];
            document.getElementById("EmployeeName").value=val[1];
         }
    }
   
     function Submit()//不能为空
      {
         var productName = document.getElementById('ProductName');
         var price = document.getElementById("Money");
         var quantity=document.getElementById("Quantity");
         var supplier = document.getElementById("SupplierName");
        
         if (supplier.value == "")
         {
            alert('请选择供应商!');
            return false;
         }
        
         if ( productName.value == "")
         {
            alert('请输入商品名称!');
            return false;
         }
         if ( price.value == "" )
         {
             alert('价格不能为空!');
             return false;
         }
         if( quantity.value == "")
         {
            alert('数量不能为空!');
            return false;
         }
                  
        
      }
    
      function checkPrice(price)//MONEY的正则表达式
      {
         if (!/^(/+)?/d+(/./d{1,2})?$/.test(price.value))
         {
            price.value="0.00";
         }
        
      }
     
      function checkQuantity(Quantity)//数量的正则表达式
      {
         if(!/^/d+$/.test(Quantity.value))
         {
             Quantity.value="0.00";            
         }
         if(Quantity.value=="")
         {
            Quantity.value="0.00";
         }
      }
     
      function checkTaxRate(TaxRate)//税率的正由表达式
      {
         if (!/^(/+)?/d+(/./d+)?$/.test(TaxRate.value))
         {
            TaxRate.value="0.00";
         }
         if(TaxRate.value > 99)
         {
            TaxRate.value="0.00";
         }
         if (TaxRate.value =="")
         {
            TaxRate.value="0.00";
         }
      } 
    </script>

你可能感兴趣的:(正则表达式,function,null,url)