当前位置:编程学习 > JAVA >>

jquery foreach

<form id="input_iForm" action="${pageContext.request.contextPath}/transfer/input_salary.shtml"> 
  
  <input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/> 
  
      <input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/> 
  
      <input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/> 
  
</form> 
  
  
  
  
  
$("input").each(function(index){ //取得整个页面的input值 
  
$("input:text").each(function(index){ 
  alert(index);//循环的下标值,从0开始 
  alert(this.value);  alert($(this).attr("type"));  //自带属性可以用this(Dom)直接取值 
  alert($(this).attr("vili"));                               //自定义属性需要用attr(Jquery)取值 
  //if($(this).attr("vili")=="true"&&){ 
      
  //} 
 });  

 

 

 

Js代码
$.ajax({ 
      url: '<%=basePath%>schedule/getMonthRecordLs.action', 
      dataType: 'json', 
      success: function(data) { 
          var events = []; 
          $(data).each(function(i,val) { 
              events.push({ 
                id: val.sc_id, 
                  title: val.sc_planemp, 
                  start: new Date(val.sc_date), 
                  color: val.sc_classes=='1'?'':'#993300' 
              }); 
          }); 
          callback(events); 
      } 
  }); 


 

补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,