zoukankan      html  css  js  c++  java
  • 可参考的js代码

    function addcompanyFinalBalance(){
    
    	var currentDate = new Date();
    	var currentYear = date.getFullYear();// 当前年份
    	var previousMonth = date.getMonth();//  当前上一月份
    	//====================================================================================
    	var yearAndTime = $("#companyTime").find("td:last").find("label").text();
    
    	var yearindex = yearAndTime.lastIndexOf("年");
    	var myYear=yearAndTime.substring(0,yearindex);
    
    	var monthindex=yearAndTime.lastIndexOf("月");
    	var myMonth=yearAndTime.substring(yearindex+1,monthindex);
    	
    	myMonth= parseInt(myMonth)+1;
    	if (myMonth>=12) {
    		myMonth=1;
    		myYear++;
    	}
    
    	/*if(myYear>=currentYear&&myMonth>previousMonth){
    		$.messager.alert("提示","已达到最大期值,无法再增加!","info");
    		return;
    	}*/
    	//====================================================================================
    	var rows =$("#balance").find("tr");
    
    	rows.each(
    		function(index,element){
    			var idvalue=$(element).attr("id");
    			if(index==0){	
    				var neddAppend="<td><input type='hidden' name='colyear' value="+myYear+"><input type='hidden' name='colmonth' value="+myMonth+"><label>"+myYear+"年"+myMonth+"月</label></td>";
    				$(element).append(neddAppend);		
    			}else if(index==rows.length-1){
    				var neddAppend="<td>0</td>";
    				$(element).append(neddAppend);
    			}else if(idvalue=='a_1000'){
    				//noithing
    			}else{
    				//拿到当前tr 最后一个td 内input 的标识 myflag
    				var index=$(element).find("td:last").find("[myid='closeinfoserialid']").attr("myflag");
    				var mBankname=$(element).find("td:last").find("[id='gongsitype']").attr("value");
    				var myFristAddAccountNum=$(element).find("td:last").find("[myFristAddAccountNumId='myFristAddAccountNumId']").attr("value");
    
    				var myBalanceSerialIdValue=$(element).find("td:last").find("[mybalanceserialid='mybalanceserialid']").attr("mybalanceserialidvalue");
    				var myBankNameValue=$(element).find("td:last").find("[mybanknameid='mybanknameid']").attr("mybanknamevalue");
    				var myAccountNumbValue=$(element).find("td:last").find("[myaccountnumb='accountnumb']").attr("value");
    
    				if(typeof(index)=="undefined"){
    
    					if(typeof(myAccountNumbValue)=="undefined"){
    						myAccountNumbValue=myFristAddAccountNum;
    					}
    					
    					var htmlcontent="<td name="bankmonytd"><input type="hidden"  name="bankcloseInfoList.closeinfoserialid"  /><input type="hidden"  name="bankcloseInfoList.balanceserialid" value="+myBalanceSerialIdValue+"  mybalanceserialid="mybalanceserialid" /><input type="hidden"  name="bankcloseInfoList.bankname"  id="gongsitype" class="gongsitype" value="+mBankname+" /><input type="hidden"  name="bankcloseInfoList.accountnum"  value="+myAccountNumbValue+"  myaccountnumb="accountnumb"  myaccountnumbvalue="+myAccountNumbValue+" /><input type="hidden"  name="bankcloseInfoList.year"   /><input type="hidden"  name="bankcloseInfoList.month"  /><input type="text" style=" 95%"  name="bankcloseInfoList.money" onblur="reCount(this);" class="easyui-validatebox" data-options="required:true,validType:'number'"/></td>";
    					$(element).append(htmlcontent);
    					return;
    				}
    				
    				index=parseInt(index)+1;
    
    				var htmlcontent="<td name="bankmonytd"><input type="hidden"  name="bankcloseInfoList["+index+"].closeinfoserialid"   myflag="+index+"  myid="closeinfoserialid" /><input type="hidden"  name="bankcloseInfoList["+index+"].balanceserialid" value="+myBalanceSerialIdValue+"  mybalanceserialid="mybalanceserialid"  mybalanceserialidvalue="+myBalanceSerialIdValue+" /><input type="hidden"  name="bankcloseInfoList["+index+"].bankname"  id="gongsitype" class="gongsitype" value="+myBankNameValue+"  mybanknameid="mybanknameid"  mybanknamevalue="+myBankNameValue+" /><input type="hidden"  name="bankcloseInfoList["+index+"].accountnum"  value="+myAccountNumbValue+"   myaccountnumb="accountnumb"   myaccountnumbvalue="+myAccountNumbValue+" /><input type="hidden"  name="bankcloseInfoList["+index+"].year" value="+myYear+"  /><input type="hidden"  name="bankcloseInfoList["+index+"].month" value="+myMonth+" /><input type="text" style=" 95%"  name="bankcloseInfoList["+index+"].money" onblur="reCount(this);" class="easyui-validatebox" data-options="required:true,validType:'number'"/></td>";
    				$(element).append(htmlcontent);
    			}
    		});	
    	}
    

      

  • 相关阅读:
    [转]Linux中用编译的Zlib库替换系统自带的
    [转]Leptonica在VS2010中的编译及简单使用举例
    我的tesseract学习记录
    [转]在VS2010下编译和使用tesseract_ocr
    [转]图像resize
    JVM基础知识(摘抄整理)
    JVM运行时数据内存区和指令集(摘抄整理)
    JMM For Object Size(摘抄整理)
    JMM课程小结(摘抄整理)
    Class的加载过程
  • 原文地址:https://www.cnblogs.com/xh_Blog/p/9133390.html
Copyright © 2011-2022 走看看