SOURCE

<script type="text/javascript">
var sbje1="field88953";//专用发票3% 实报金额
var sbje2="field88954";//专用发票6% 实报金额
var sbje3="field88955";//航空、铁路 实报金额
var sbje4="field88952";//公路 水路合计 电子发票3% 实报金额
var pjzs1="field88961";//专用发票3% 票据张数 
var pjzs2="field88962";//专用发票6% 票据张数 
var pjzs3="field88963";//航空、铁路 票据张数 
var pjzs4="field88960";//公路 水路合计 电子发票3% 票据张数 
var se1="field88949";//专用发票3% 税额
var se2="field88950";//专用发票6% 税额
var se3="field88951";//航空、铁路 税额
var se4="field88948";//公路 水路合计 电子发票3% 税额

var zsfpjlx_mx="field88938";//住宿费票据类型 无:5  普通发票:6   专用发票3%:7 专用发票6%:8
var zsffphm_mx="field88905";//住宿费发票号码
var zsfpjzs_mx="field88964";//住宿费票据张数
var zsfsqje_mx="field88916";//住宿费申请金额
var zsfsbje_mx="field88970";//住宿费实报金额
var zsfse_mx="field88906";//住宿费税额
var zsfbhsje_mx="field88993";//住宿费不含税金额

var snjtfpjlx_mx="field88939";//市内交通费票据类型 无:9   其他发票:10 电子发票3%:11
var snjtffphm_mx="field88908";//市内交通费发票号码
var snjtfpjzs_mx="field88918";//市内交通费票据张数
var snjtfsqje_mx="field88917";//市内交通费申请金额
var snjtfsbje_mx="field88920";//市内交通费实报金额
var snjtfse_mx="field88909";//市内交通费税额
var snjtfksrq_mx="field88911";//市内交通费开始日期
var snjtfjsrq_mx="field88912";//市内交通费结束日期

var jtfpjlx_mx="field88940";//交通费票据类型 公路3  水路4 铁路5 航空6
var jtfsmxx_mx="field88941";//交通实名选项 是1 否0
var jtfpjzs_mx="field88925";//交通票据张数
var jtfsqje_mx="field88922";//交通申请金额
var jtfsbje_mx="field88924";//交通实报金额
var jtfse_mx="field88903";//交通税额
var jtfse1_mx="field88977";//航空税额
var jtfmhfzjj_mx="field88976";//民航发展基金
var jtfksrq_mx="field88913";//交通费开始日期
var jtfjsrq_mx="field88914";//交通费结束日期

var pj1_hj = "field88931"; //票据1
var pj2_hj = "field88932";//票据2
var pj3_hj = "field88965";//票据3
var zpj_hj = "field88983";//总票据


var bxr = "field88852"; //报销人
var jbr = "field88765"; //经办人
var rypd = "field104788";//人员判断
var gsdm = "field88985";// 公司代码

jQuery(document).ready(function(){
			var check = new dataCheck();
			check.indexnum("indexnum7");
			//明细表多字段监听
			check.addDtField([jtfpjlx_mx,jtfksrq_mx], reFreshmx8);
			//check.addDtField([jtfpjlx_mx,jtfsmxx_mx,jtfsbje_mx,jtfpjzs_mx,jtfmhfzjj_mx], getHJ_MX8);
			//check.addDtField([jtfpjlx_mx,jtfsmxx_mx,jtfsbje_mx,jtfpjzs_mx], getHJ_MX8_9);
			check.start(1000);
			
			var check1 = new dataCheck();
			check1.indexnum("indexnum8");
			//明细表多字段监听
			check1.addDtField([zsfpjlx_mx,snjtfpjlx_mx], reFreshmx9);
			//check1.addDtField([zsfpjlx_mx,zsfsbje_mx,zsfpjzs_mx], getHJ_MX9);
			//check1.addDtField([snjtfpjlx_mx,snjtfsbje_mx,snjtfpjzs_mx], getHJ_MX8_9);
			check1.start(1000);
			
			
			
			var check3 = new dataCheck();
			check3.addField([pj1_hj,pj2_hj,pj3_hj],sumpjsl);
			check3.start(1000);
			
			//重写checkCustomize函数
			checkCustomize = function (){
			if($("#"+bxr).val() == $("#"+jbr).val()){
			setFMVal(rypd,0,0)
			}else
				{
			setFMVal(rypd,1,1)
			}
				if(checkmx8()&&checkmx9()){
						return true;
					}else{
						return false;
					}
			}
			

	});

	function  sumpjsl(){
	var sum;
	
	sum = toDecimal($GetEle(pj1_hj).value)+ toDecimal($GetEle(pj2_hj).value)+toDecimal($GetEle(pj3_hj).value);
 


	setFMVal(zpj_hj,sum);
	}
	
	//日期判断
	function checkmx8(){
	var indexnum8= jQuery("#indexnum7").val();
	for(var i=0;i<indexnum8;i++){
		if(jQuery("#"+jtfksrq_mx+"_"+i).length>0){
		var ksrq_value=jQuery("#"+jtfksrq_mx+"_"+i).val();
		var jsrq_value=jQuery("#"+jtfjsrq_mx+"_"+i).val();
				if(duibi(ksrq_value,getNowFormatDate(),"交通费起始日期",i)){			
					return false;
				}
				if(duibi(jsrq_value,getNowFormatDate(),"交通费结束日期",i)){			
					return false;
				}
			}
		}
		return true;
	}

	function checkmx9(){
		var indexnum9= jQuery("#indexnum8").val();
		for(var i=0;i<indexnum9;i++){
			if(jQuery("#"+snjtfksrq_mx+"_"+i).length>0){
			var ksrq_value=jQuery("#"+snjtfksrq_mx+"_"+i).val();
			var jsrq_value=jQuery("#"+snjtfjsrq_mx+"_"+i).val();
	
				if(duibi(ksrq_value,getNowFormatDate(),"住宿及市内交通费起始日期",i)){			
						return false;
				}
				if(duibi(jsrq_value,getNowFormatDate(),"住宿及市内交通费结束日期",i)){			
					return false;
				}
			}
			
		}
		return true;
	}
function duibi(a, b,rq_name,index) {
    var arr = a.split("-");
    var starttime = new Date(arr[0], arr[1], arr[2]);
    var starttimes = starttime.getTime();

    var arrs = b.split("-");
    var lktime = new Date(arrs[0], arrs[1], arrs[2]);
    var lktimes = lktime.getTime();

    if (starttimes > lktimes) {

        alert('第'+(index+1)+'行,'+rq_name+'不能大于当前日期,请修改后提交');
        return true;
    }
    else
        return false;

}

//获取当前时间,格式YYYY-MM-DD
    function getNowFormatDate() {
        var date = new Date();
        var seperator1 = "-";
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = year + seperator1 + month + seperator1 + strDate;
        return currentdate;
    }
	
	function reFreshmx8(){
	var indexnum8= jQuery("#indexnum7").val();
	for(var i=0;i<indexnum8;i++){
		var jtfjpjlx_value=jQuery("#"+jtfpjlx_mx+"_"+i).val();
		//alert(jtfjpjlx_value)
		if(jQuery("#"+jtfpjlx_mx+"_"+i).length>0){
			if(jtfjpjlx_value==5){
						needcheck(jtfmhfzjj_mx+"_"+i);
						 document.getElementById(jtfmhfzjj_mx+"_"+i).readOnly =false;
					}else{
						deleteneedcheck(jtfmhfzjj_mx+"_"+i);
						 setFMVal(jtfmhfzjj_mx+"_"+i,'','');
						 document.getElementById(jtfmhfzjj_mx+"_"+i).readOnly =true;
					}
					
			
		
			jQuery("#"+jtfpjlx_mx+"_"+i).bindPropertyChange(function(obj){
					var pjlx_v=obj.value;
					var num=obj.id.split("_")[1];
					if(pjlx_v==5){
						needcheck(jtfmhfzjj_mx+"_"+num);
						 document.getElementById(jtfmhfzjj_mx+"_"+num).readOnly =false;
					}else{
						deleteneedcheck(jtfmhfzjj_mx+"_"+num);
						 setFMVal(jtfmhfzjj_mx+"_"+num,'','');
						 document.getElementById(jtfmhfzjj_mx+"_"+num).readOnly =true;
					}
					
					
				});

		}
	}
}

function reFreshmx9(){
	var indexnum8= jQuery("#indexnum8").val();
	for(var i=0;i<indexnum8;i++){
		if(jQuery("#"+zsfpjlx_mx+"_"+i).length>0){
		var zsfpjlx_value=jQuery("#"+zsfpjlx_mx+"_"+i).val();
		var snjtfpjlx_value=jQuery("#"+snjtfpjlx_mx+"_"+i).val();
			if(zsfpjlx_value==7||zsfpjlx_value==8){
						//needcheck(zsffphm_mx+"_"+i);
						needcheck(zsfpjzs_mx+"_"+i);
						needcheck(zsfsqje_mx+"_"+i);
						needcheck(zsfse_mx+"_"+i);
						needcheck(zsfbhsje_mx+"_"+i);
						// document.getElementById(zsffphm_mx+"_"+i).readOnly =false;
						 document.getElementById(zsfpjzs_mx+"_"+i).readOnly =false;
						 document.getElementById(zsfsqje_mx+"_"+i).readOnly =false;
						 document.getElementById(zsfse_mx+"_"+i).readOnly =false;
						 document.getElementById(zsfbhsje_mx+"_"+i).readOnly =false;
					}else if(zsfpjlx_value==6){
						deleteneedcheck(zsfse_mx+"_"+i);
						deleteneedcheck(zsfbhsje_mx+"_"+i);
						//deleteneedcheck(zsffphm_mx+"_"+i);
						needcheck(zsfpjzs_mx+"_"+i);
						needcheck(zsfsqje_mx+"_"+i);
						// document.getElementById(zsffphm_mx+"_"+i).readOnly =true;
						document.getElementById(zsfse_mx+"_"+i).readOnly =true;
						document.getElementById(zsfbhsje_mx+"_"+i).readOnly =true;
						 document.getElementById(zsfpjzs_mx+"_"+i).readOnly =false;
						 document.getElementById(zsfsqje_mx+"_"+i).readOnly =false;
					}else{
						//deleteneedcheck(zsffphm_mx+"_"+i);
						deleteneedcheck(zsfpjzs_mx+"_"+i);
						deleteneedcheck(zsfsqje_mx+"_"+i);
						deleteneedcheck(zsfse_mx+"_"+i);
						deleteneedcheck(zsfbhsje_mx+"_"+i);
						 //setFMVal(zsffphm_mx+"_"+i,'','');
						 setFMVal(zsfpjzs_mx+"_"+i,'','');
						 setFMVal(zsfsqje_mx+"_"+i,'','');
						// document.getElementById(zsffphm_mx+"_"+i).readOnly =true;
						document.getElementById(zsfse_mx+"_"+i).readOnly =true;
						document.getElementById(zsfbhsje_mx+"_"+i).readOnly =true;
						 document.getElementById(zsfpjzs_mx+"_"+i).readOnly =true;
						 document.getElementById(zsfsqje_mx+"_"+i).readOnly =true;
					}
					
			if(snjtfpjlx_value==11){
						//needcheck(snjtffphm_mx+"_"+i);
						needcheck(snjtfpjzs_mx+"_"+i);
						needcheck(snjtfsqje_mx+"_"+i);
						 //document.getElementById(snjtffphm_mx+"_"+i).readOnly =false;
						 document.getElementById(snjtfpjzs_mx+"_"+i).readOnly =false;
						 document.getElementById(snjtfsqje_mx+"_"+i).readOnly =false;
					}else if(snjtfpjlx_value==10){
						//deleteneedcheck(snjtffphm_mx+"_"+i);
						needcheck(snjtfpjzs_mx+"_"+i);
						needcheck(snjtfsqje_mx+"_"+i);
						// document.getElementById(snjtffphm_mx+"_"+i).readOnly =true;
						 document.getElementById(snjtfpjzs_mx+"_"+i).readOnly =false;
						 document.getElementById(snjtfsqje_mx+"_"+i).readOnly =false;
					}else{
						//deleteneedcheck(snjtffphm_mx+"_"+i);
						deleteneedcheck(snjtfpjzs_mx+"_"+i);
						deleteneedcheck(snjtfsqje_mx+"_"+i);
						// setFMVal(snjtffphm_mx+"_"+i,'','');
						 setFMVal(snjtfpjzs_mx+"_"+i,'','');
						 setFMVal(snjtfsqje_mx+"_"+i,'','');
						 //document.getElementById(snjtffphm_mx+"_"+i).readOnly =true;
						 document.getElementById(snjtfpjzs_mx+"_"+i).readOnly =true;
						 document.getElementById(snjtfsqje_mx+"_"+i).readOnly =true;
					}
		
			jQuery("#"+zsfpjlx_mx+"_"+i).bindPropertyChange(function(obj){
					var pjlx_v=obj.value;
					//alert(pjlx_v)
					var num=obj.id.split("_")[1];
					if(pjlx_v==7||pjlx_v==8){
						//needcheck(zsffphm_mx+"_"+num);
						needcheck(zsfpjzs_mx+"_"+num);
						needcheck(zsfsqje_mx+"_"+num);
						needcheck(zsfse_mx+"_"+num);
						needcheck(zsfbhsje_mx+"_"+num);
						// document.getElementById(zsffphm_mx+"_"+num).readOnly =false;
						 document.getElementById(zsfpjzs_mx+"_"+num).readOnly =false;
						 document.getElementById(zsfsqje_mx+"_"+num).readOnly =false;
						 document.getElementById(zsfse_mx+"_"+num).readOnly =false;
						 document.getElementById(zsfbhsje_mx+"_"+num).readOnly =false;
					}else if(pjlx_v==6){
						//deleteneedcheck(zsffphm_mx+"_"+num);
						needcheck(zsfpjzs_mx+"_"+num);
						needcheck(zsfsqje_mx+"_"+num);
						deleteneedcheck(zsfse_mx+"_"+num);
						deleteneedcheck(zsfbhsje_mx+"_"+num);
						 //setFMVal(zsffphm_mx+"_"+num,'','');
						 document.getElementById(zsffphm_mx+"_"+num).readOnly =true;
						 document.getElementById(zsfpjzs_mx+"_"+num).readOnly =false;
						 document.getElementById(zsfsqje_mx+"_"+num).readOnly =false;
						document.getElementById(zsfse_mx+"_"+num).readOnly =true;
						document.getElementById(zsfbhsje_mx+"_"+num).readOnly =true;
					}else{
						//deleteneedcheck(zsffphm_mx+"_"+num);
						deleteneedcheck(zsfpjzs_mx+"_"+num);
						deleteneedcheck(zsfsqje_mx+"_"+num);
						deleteneedcheck(zsfse_mx+"_"+num);
						deleteneedcheck(zsfbhsje_mx+"_"+num);
						// setFMVal(zsffphm_mx+"_"+num,'','');
						 setFMVal(zsfpjzs_mx+"_"+num,'','');
						 setFMVal(zsfsqje_mx+"_"+num,'','');
						document.getElementById(zsfse_mx+"_"+num).readOnly =true;
						document.getElementById(zsfbhsje_mx+"_"+num).readOnly =true;
						// document.getElementById(zsffphm_mx+"_"+num).readOnly =true;
						 document.getElementById(zsfpjzs_mx+"_"+num).readOnly =true;
						 document.getElementById(zsfsqje_mx+"_"+num).readOnly =true;
					}
					//calOperate.calRowRule_allRow(8);
				});
			jQuery("#"+snjtfpjlx_mx+"_"+i).bindPropertyChange(function(obj){
					var pjlx_v=obj.value;
					var num=obj.id.split("_")[1];
					
					if(pjlx_v==11){
						//needcheck(snjtffphm_mx+"_"+num);
						needcheck(snjtfpjzs_mx+"_"+num);
						needcheck(snjtfsqje_mx+"_"+num);
						// document.getElementById(snjtffphm_mx+"_"+num).readOnly =false;
						 document.getElementById(snjtfpjzs_mx+"_"+num).readOnly =false;
						 document.getElementById(snjtfsqje_mx+"_"+num).readOnly =false;
					}else if(pjlx_v==10){
						//deleteneedcheck(snjtffphm_mx+"_"+num);
						needcheck(snjtfpjzs_mx+"_"+num);
						needcheck(snjtfsqje_mx+"_"+num);
						// document.getElementById(snjtffphm_mx+"_"+num).readOnly =true;
						 document.getElementById(snjtfpjzs_mx+"_"+num).readOnly =false;
						 document.getElementById(snjtfsqje_mx+"_"+num).readOnly =false;
					}else{
						//deleteneedcheck(snjtffphm_mx+"_"+num);
						deleteneedcheck(snjtfpjzs_mx+"_"+num);
						deleteneedcheck(snjtfsqje_mx+"_"+num);
						 //setFMVal(snjtffphm_mx+"_"+num,'','');
						 setFMVal(snjtfpjzs_mx+"_"+num,'','');
						 setFMVal(snjtfsqje_mx+"_"+num,'','');
						 //document.getElementById(snjtffphm_mx+"_"+num).readOnly =true;
						 document.getElementById(snjtfpjzs_mx+"_"+num).readOnly =true;
						 document.getElementById(snjtfsqje_mx+"_"+num).readOnly =true;
					}
					//calOperate.calRowRule_allRow(8);
				});
		}
		
		
	
			
	}
}
	
	function getHJ_MX9(){ //明细9合计 专用发票3%:7 专用发票6%:8
			var sumsbje1 =getsumprice("indexnum8",zsfpjlx_mx,7,zsfsbje_mx);
			//alert(sumsbje1)
			var sumsbje2 =getsumprice("indexnum8",zsfpjlx_mx,8,zsfsbje_mx);
			var sumpjzs1=getsumprice("indexnum8",zsfpjlx_mx,7,zsfpjzs_mx);
			var sumpjzs2=getsumprice("indexnum8",zsfpjlx_mx,8,zsfpjzs_mx);
			var sumse1 =getsumprice("indexnum8",zsfpjlx_mx,7,zsfse_mx);
			var sumse2 =getsumprice("indexnum8",zsfpjlx_mx,8,zsfse_mx);
			setFMVal(sbje1,sumsbje1,sumsbje1);
			setFMVal(sbje2,sumsbje2,sumsbje2);
			setFMVal(pjzs1,sumpjzs1,sumpjzs1);
			setFMVal(pjzs2,sumpjzs2,sumpjzs2);
//wyy
			setFMVal(se1,toDecimal(sumse1),toDecimal(sumse1));
			setFMVal(se2,toDecimal(sumse2),toDecimal(sumse2));
   }
   
  function getHJ_MX8(){ //明细8合计 公路3  水路4 航空5 铁路6
			//航空 铁路合计
			var sumsbje1 =getsumprice1("indexnum7",jtfpjlx_mx,5,jtfsmxx_mx,1,jtfsbje_mx);
			var sumsbje2 =getsumprice1("indexnum7",jtfpjlx_mx,6,jtfsmxx_mx,1,jtfsbje_mx);
			var sumpjzs1=getsumprice1("indexnum7",jtfpjlx_mx,5,jtfsmxx_mx,1,jtfpjzs_mx);
			var sumpjzs2=getsumprice1("indexnum7",jtfpjlx_mx,6,jtfsmxx_mx,1,jtfpjzs_mx);
			var sumse1 =getsumprice1("indexnum7",jtfpjlx_mx,5,jtfsmxx_mx,1,jtfse1_mx);
			var sumse2 =getsumprice1("indexnum7",jtfpjlx_mx,6,jtfsmxx_mx,1,jtfse_mx);
			setFMVal(sbje3,sumsbje1+sumsbje2,sumsbje1+sumsbje2);
			setFMVal(pjzs3,sumpjzs1+sumpjzs2,sumpjzs1+sumpjzs2);
//wyy
			setFMVal(se3,toDecimal(sumse1+sumse2),toDecimal(sumse1+sumse2));
   }
   
   
 function getHJ_MX8_9(){ //明细8+明细9 合计 公路3  水路4 航空5 铁路6
			//公路 水路合计 电子发票3% 11
			var sumsbje1 =getsumprice1("indexnum7",jtfpjlx_mx,3,jtfsmxx_mx,1,jtfsbje_mx);
			var sumsbje2 =getsumprice1("indexnum7",jtfpjlx_mx,4,jtfsmxx_mx,1,jtfsbje_mx);
			var sumsbje3 =getsumprice("indexnum8",snjtfpjlx_mx,11,snjtfsbje_mx);
			var sumpjzs1=getsumprice1("indexnum7",jtfpjlx_mx,3,jtfsmxx_mx,1,jtfpjzs_mx);
			var sumpjzs2=getsumprice1("indexnum7",jtfpjlx_mx,4,jtfsmxx_mx,1,jtfpjzs_mx);
			var sumpjzs3 =getsumprice("indexnum8",snjtfpjlx_mx,11,snjtfpjzs_mx);
			var sumse1 =getsumprice1("indexnum7",jtfpjlx_mx,3,jtfsmxx_mx,1,jtfse_mx);
			var sumse2 =getsumprice1("indexnum7",jtfpjlx_mx,4,jtfsmxx_mx,1,jtfse_mx);
			var sumse3 =getsumprice("indexnum8",snjtfpjlx_mx,11,snjtfse_mx);
			setFMVal(sbje4,sumsbje1+sumsbje2+sumsbje3,sumsbje1+sumsbje2+sumsbje3);
			setFMVal(pjzs4,sumpjzs1+sumpjzs2+sumpjzs3,sumpjzs1+sumpjzs2+sumpjzs3);
//添加todecimal wyy
			setFMVal(se4, toDecimal(sumse1+sumse2+sumse3) , toDecimal(sumse1+sumse2+sumse3));
   }


	//index 明细id  明细1:indexnum0   typefieldid求和类型字段id  value 求和类型值 
	   function getsumprice(index,typefieldid,value,jefield){
					var sum=0;
					var price=0;
				   indexnum = jQuery("#"+index).val() * 1.0;
				 if(jQuery("#"+index).length>0){//判断该字段是否存在
				  for(i=0;i<indexnum;i++){
					  if(jQuery('#'+typefieldid+'_'+i).length>0){
						  if(jQuery('#'+typefieldid+'_'+i).val()==value&&jQuery('#'+typefieldid+'_'+i).val()!=""){
						  price=parseFloat(jQuery('#'+jefield+'_'+i).val());
							  if(isNaN(price)){price=0;}
							 sum=sum+price;
						  }
					}
				  }
				 }
				return toDecimal(sum);
				}
	
	//index 明细id  明细1:indexnum0   typefieldid求和类型字段id  value 求和类型值 
	   function getsumprice1(index,typefieldid,value,typefieldid1,value1,jefield){
					var sum=0;
					var price=0;
				   indexnum = jQuery("#"+index).val() * 1.0;
				 if(jQuery("#"+index).length>0){//判断该字段是否存在
				  for(i=0;i<indexnum;i++){
					  if(jQuery('#'+typefieldid+'_'+i).length>0){
						  if(jQuery('#'+typefieldid+'_'+i).val()==value&&jQuery('#'+typefieldid+'_'+i).val()!=""&&jQuery('#'+typefieldid1+'_'+i).val()==value1&&jQuery('#'+typefieldid1+'_'+i).val()!=""){
						  price=parseFloat(jQuery('#'+jefield+'_'+i).val());
							  if(isNaN(price)){price=0;}
							 sum=sum+price;
						  }
					}
				  }
				 }
				return toDecimal(sum);
				}
				
	function toDecimal(x) {
            var f = parseFloat(x);
            if (isNaN(f)) {
                return;
            }
            f = Math.round(x*100)/100;
            return f;
        }
		
	function setFMVal(id,v,h)
	  {
	   var ismandStr = '<IMG src="/'+"images"+"/"+'BacoError_wev8.gif" align="absMiddle">';
	   var x= jQuery('#'+id);
		 if(x.length > 0){
		  x.attr({'value':v});
		  if(x.attr('type') == 'hidden' || document.getElementById(id).style.display == 'none'){
	   
		   jQuery('#'+id+'span').html('');
		   if(arguments.length>2){
			jQuery('#'+id+'span').html(h);
		   }else{
			jQuery('#'+id+'span').html(v);
		   }
		   
		  }else{
		   var viewtype = x.attr('viewtype');
		   if(viewtype == 1 && (!v || v == '')){
			jQuery('#'+id+'span').html(ismandStr);
		   }else{
			jQuery('#'+id+'span').html('');
		   }
		  }
		 }
	  }
  
  
   function needcheck(fieldid){//加必填
    var needcheck = document.all("needcheck"); //获取必填框
	 //var a1="<IMG src=\'/images/BacoError.gif\' align=absMiddle>";
	 var a1='<IMG src="/'+"images"+"/"+'BacoError_wev8.gif" align="absMiddle">';
	if(needcheck.value!=undefined){
			if(needcheck.value.indexOf(fieldid)<0){
					 if(jQuery("#"+fieldid+"span").html()==""&&jQuery("#"+fieldid).val()==""){
						jQuery("#"+fieldid+"span").html(a1);
				   }
                          needcheck.value+=",";
                            needcheck.value+=fieldid;
                     jQuery("#"+fieldid).bind('change',function(){
					//alert("fieldid===="+fieldid)
                           var b= jQuery("#"+fieldid).val();
                      // alert(b);
                     if(b==''){ jQuery("#"+fieldid+"span").html(a1);}
          })
		}
	}
}



 function deleteneedcheck(fieldid){//去必填
 var needcheck = document.all("needcheck"); //获取必填框
	if(needcheck.value!=undefined){
           var a="";
                   a=needcheck.value.replace(","+fieldid,"");
                        needcheck.value=a;
   jQuery("#"+fieldid).attr("value","");
                         jQuery("#"+fieldid+"span").html("");}
 }


</script>
<script>
/**
 * ecology 工具类
 */
//隔时检查工具类
function dataCheck(){
	//数据对象
	var dataObj={
			time:2000,//运行间隔
			_mn:[],//主表字段数组
			_dt:[],//明细字段数组
			_isStartCheck:true,//是否一开始就进行数据检测
			_indexnum:"indexnum0",//明细扫描依赖数据,如检测明细2,请修改
			_nowData:{},//记录上次记录数据
			_updateNowData:function(){
				//更新缓存池数据
				//主表
				//完成方法触发,再次循环修改被被修改数据
				for(var i=0;i<dataObj._mn.length;i++){
					var mnData=dataObj._mn[i];
					//遍历一组数据字段id
					for(var j=0;j<mnData.id.length;j++){
						
						var fieldObj=jQuery("#"+mnData.id[j]);
						//数据存在,并且与上次数据不同
						if(typeof(fieldObj)!="undefined"&&fieldObj.val()!=dataObj._nowData[mnData.id[j]]){
							dataObj._nowData[mnData.id[j]]=fieldObj.val();
						}
					}
				}
				//明细
				var indexnum=jQuery("#"+dataObj._indexnum).val();
				//完成方法触发,再次循环修改被被修改数据
				for(var k=0;k<indexnum;k++){
					for(var i=0;i<dataObj._dt.length;i++){
						var dtData=dataObj._dt[i];
						//遍历一组数据字段id
						for(var j=0;j<dtData.id.length;j++){
							var fieldObj=jQuery("#"+dtData.id[j]+"_"+k);
							//数据存在,并且与上次数据不同
							if(typeof(fieldObj)!="undefined"&&fieldObj.val()!=dataObj._nowData[dtData.id[j]+"_"+k]){
								dataObj._nowData[dtData.id[j]+"_"+k]=fieldObj.val();
							}
						}
					}
				}
			},
			_doCallBack:function(){
				//遍历_mn主数据监测
				for(var i=0;i<dataObj._mn.length;i++){
					var mnData=dataObj._mn[i];
					//遍历一组数据字段id
					for(var j=0;j<mnData.id.length;j++){
						var fieldObj=jQuery("#"+mnData.id[j]);
						//数据存在,并且与上次数据不同
						if(typeof(fieldObj)!="undefined"&&fieldObj.val()!=dataObj._nowData[mnData.id[j]]){
							//调用方法
							mnData.fun(mnData.id);
							break;
						}
					}
				}
				
				//进行明细处理
				//行循环
				var indexnum=jQuery("#"+dataObj._indexnum).val();
				for(var k=0;k<indexnum;k++){
					//遍历_dt主数据监测
					for(var i=0;i<dataObj._dt.length;i++){
						var dtData=dataObj._dt[i];
						//遍历一组数据字段id
						for(var j=0;j<dtData.id.length;j++){
							var fieldObj=jQuery("#"+dtData.id[j]+"_"+k);
							//数据存在,并且与上次数据不同 同时需要记录下标
							if(typeof(fieldObj)!="undefined"&&fieldObj.val()!=dataObj._nowData[dtData.id[j]+"_"+k]){
								//调用方法,并且传入下标
								dtData.fun(k,dtData.id);
								break;
							}
						}
					}
				}
				//明细遍历结束
				//进行上次数据变化记录
				dataObj._updateNowData();
				
			}
			
	};
	//暴露数组部分数据,方便修改
	this.mn=dataObj._mn;
	this.dt=dataObj._dt;
	this.indexnum=dataObj._indexnum;
	//任务开始
	this.start=function(time){//开始运行
		if(arguments.length>0&&typeof(time)=="number"){
			dataObj.time=time;
		}
		//开始检测的时候是否进行数据的第一次更改
		if(!dataObj._isStartCheck){
			dataObj._updateNowData();
		}
		window.setInterval(dataObj._doCallBack, dataObj.time);
		return this;
	};
	//用于更改配置下列
	
	this.isStartCheck=function(obj){
		dataObj._isStartCheck=obj;
		return this;
	}
	this.indexnum=function(obj){
		dataObj._indexnum=obj;
		return this;
	}
	
	//插入主表数据
	this.addField=function(id,fun){
		//检测数据参数
		var data=[];
		if(id!=""&&typeof(id)!="undefined"){
			if(typeof(id)=="string"||typeof(id)=="number"){
				data.push(id);
			}else{
				data=id;
			}
		}
		
		if(typeof(fun)=="function"){
			//加入到主表数据中
			dataObj._mn.push({id:data,fun:fun})
		}
		return this;
	};
	//插入明细数据
	this.addDtField=function(id,fun){
		//检测数据参数
		var data=[];
		if(id!=""&&typeof(id)!="undefined"){
			if(typeof(id)=="string"||typeof(id)=="number"){
				data.push(id);
			}else{
				data=id;
			}
		}
		if(typeof(fun)=="function"){
			//加入到主表数据中
			dataObj._dt.push({id:data,fun:fun})
		}
		return this;
	};
	
}

</script>













console 命令行工具 X clear

                    
>
console