新建 文本文档.txt
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:5k
源码类别:

.net编程

开发平台:

C#

  1. <script type="text/javascript" language="javascript" src="../js/calendar.js"></script>
  2.      <script type="text/javascript">
  3.     //小计
  4.         function  sum1()
  5.          {
  6.            var ChargeMachine=0;
  7.            if(document.getElementById("txt_ChargeMachine").value!=0)
  8.                ChargeMachine= parseFloat(document.getElementById("txt_ChargeMachine").value);
  9.                
  10.            var  ChargeStuff=0;
  11.            if(document.getElementById("txt_ChargeStuff").value!=0)
  12.              ChargeStuff= parseFloat(document.getElementById("txt_ChargeStuff").value); 
  13.              
  14.            var  ChargeOther=0;
  15.            if(document.getElementById("txt_ChargeOther").value!=0)
  16.                ChargeOther= parseFloat(document.getElementById("txt_ChargeOther").value);   
  17.                
  18.            var  ChargeManPower= 0;
  19.            if(document.getElementById("TB_ChargeManPower").value!=0 || document.getElementById("TB_ChargeManPower").value!="" )
  20.                 ChargeManPower= parseFloat(document.getElementById("TB_ChargeManPower").value);   
  21.             
  22.            var a= ChargeMachine + ChargeStuff + ChargeOther + ChargeManPower;
  23.            document.getElementById("txt_ChargeSum").value=  cheng(a,2);
  24.            document.getElementById("TB_ChargeSum").value=  cheng(a,2);
  25.            
  26.           if( document.getElementById("TB_ChargeSum").value=="NaN")
  27.            {
  28.              document.getElementById("TB_ChargeSum").value= "0";
  29.              document.getElementById("txt_ChargeSum").value= 0;
  30.             }
  31.          }
  32.           
  33.           //保留两位小数
  34.           function  cheng(num,n)  // num:被格式化的数字,n:要保留小数的位数  
  35.             {
  36.                 var  dd=1;   
  37.                 var  tempnum;   
  38.                 for(i=0;i<n;i++)   
  39.                 {   
  40.                    dd*=10;   
  41.                 }   
  42.                 tempnum=num*dd;   
  43.                 tempnum=Math.round(tempnum);   
  44.               return  tempnum/dd;
  45.               //  alert(tempnum/dd);   
  46.             }
  47.   
  48.         function modelesswin(url,mwidth,mheight)
  49.          {
  50.            if (document.all&&window.print) 
  51.             {  url=url+"?projectid=" +document.getElementById('txt_ProjectID').value + "&projecttype =1"; 
  52.                var re= window.showModalDialog(url,"","help:0;dialogWidth=1000px;dialogHeight=450px,scroll=no;");
  53.                if (re!=undefined) 
  54.                  {
  55.                     document.getElementById("TB_ChargeMachine").value=re;
  56.                     document.getElementById("txt_ChargeMachine").value=re;
  57.                     sum1();
  58.                  }
  59.            
  60.             }
  61.         }
  62.      
  63.         function modelesswin2(url,mwidth,mheight)
  64.          { 
  65.           if (document.all&&window.print) 
  66.             { 
  67.                  url=url+"?projectid=" +document.getElementById('txt_ProjectID').value + "&projecttype =1";; 
  68.                  var re=window.showModalDialog(url,"","help:0;dialogWidth=1000px;dialogHeight=450px,status=no;scroll=no;");
  69.                 
  70.                  if (re!=undefined) 
  71.                   {
  72.                        document.getElementById("TB_ChargeStuff").value=re;
  73.                         document.getElementById("txt_ChargeStuff").value=re;
  74.                          sum1();
  75.                   }
  76.              }
  77.           }
  78.         function modelesswin3(url,mwidth,mheight)
  79.          { 
  80.           if (document.all&&window.print) 
  81.             { 
  82.                  url=url+"?projectid=" +document.getElementById('txt_ProjectID').value + "&projecttype =1";; 
  83.                  var re=window.showModalDialog(url,"","help:0;dialogWidth=800px;dialogHeight=450px,status=no;scroll=no;");
  84.                 
  85.                  if (re!=undefined) 
  86.                   {
  87.                        document.getElementById("TB_ChargeOther").value=re;
  88.                        document.getElementById("txt_ChargeOther").value=re;
  89.                         sum1();
  90.                   }
  91.              }
  92.           }
  93.           
  94.      function CheckNull()
  95.      {
  96.         var ChargeSum;
  97.         if (form1.txt_ChargeSum.value=="")
  98.         {
  99.             ChargeSum=-1;
  100.         }
  101.         else 
  102.         {
  103.             ChargeSum=parseFloat(form1.txt_ChargeSum.value);
  104.         }
  105.         var s=form1.TB_ProjectName.value;
  106.         s=s.replace(/^s+|s+$/g,"");
  107.         if ( ChargeSum <=0 || s=="")
  108.         {
  109.             alert("系统提示:请正确填写! n    1、合计必需大于零; n    2、项目名称处不可为空。");
  110.             return false;
  111.         }
  112.     }
  113.     
  114.     function checkNumber()        {             if(!(((window.event.keyCode>=48)&&(window.event.keyCode<=57))||(window.event.keyCode==13)||(window.event.keyCode==46)||(window.event.keyCode==45)))             {                   window.event.keyCode=0;                   alert("对不起,只能输入数字!");             }       }