`

js 提交form,批量勾选

阅读更多

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>

<duowan:override name="head">
 <title>服务器版本修改</title>

<script type="text/javascript">

function updateEvent(){
 var form = document.forms[0];
 if(validateIsSelect(form.all, form.dimIvers)){
  form.action='${ctx}/dimIver/batchUpdateIver.do';
  form.status.value=1;
  form.submit();
 }else{
  alert("请选择要操作的记录");
 }
}

function resetEvent(){
 var form = document.forms[0];
 if(validateIsSelect(form.all, form.dimIvers)){
  form.action='${ctx}/dimIver/batchUpdateIver.do';
  form.status.value=0;
  form.submit();
 }else{
  alert("请选择要操作的记录");
 }
}

function allselect(allobj,items){
    var state = allobj.checked;
    if(items.length){
     for(var i=0;i<items.length;i++){
      if(!items[i].disabled) items[i].checked=state;
     }
    }else{
     if(!items[i].disabled) items.checked=state;
    }
}
/*
 * 判断是否选择了记录
 */
function validateIsSelect(allobj,items){
    var state = allobj.checked;
    if(items.length){
     for(var i=0;i<items.length;i++){
      if(items[i].checked) return true;
     }
    }else{
     if(items.checked) return true;
    }
    return false;
}
</script>
</duowan:override>

<duowan:override name="content">
 <!--home{-->
 <div id="home">
  <!--overview{-->
  <div id="overview">

   <div class="col_1">

 

      
     <div class="hd">
            <h4>服务器版本修改</h4>
     </div>
    
   
    <div id="tableMenu">
   <form action="${ctx}/dimIver/getDimIverList.do" method="get" id="queryForm" name="queryForm">
     <div style="float:left;">
     产品: 
     <select id="product" name="product">
      <option value="null" <c:if test="${product=='null'}">selected </c:if>>全部</option>
         <c:forEach items="${dimProducts}" var="item">  
          <option value="${item.product }" <c:if test="${item.product==product}">selected </c:if>>
          ${item.description }
          </option>
         </c:forEach>
      </select>
                                          版本号:
                  <select id="iver" name="iver">
         <c:forEach items="${dimIvers}" var="item">  
          <option value="${item.iver }" <c:if test="${item.iver==iver}">selected </c:if>>
            <c:choose>
              <c:when test="${item.iver=='null'}">全部</c:when>
              <c:when test="${item.iver=='other'}">其他</c:when>
              <c:otherwise>${item.iver}</c:otherwise>
               </c:choose>
          </option>
         </c:forEach>
      </select>
      状态:
      <select id="status" name="status">
         <option value="1" <c:if test="${status==1}">selected </c:if>>线上版本</option>
         <option value="0" <c:if test="${status==0}">selected </c:if>>线下版本</option>
      </select>
     
     </div>
                
                  <div style="float:left;margin:10px 0 0 30px;">
                   <input class="btn3"  type="submit" value="查询" />
                   </div>
                          
     
   
    </div>

         </div>

   <div id="datarea">
        
     <table>
      <tbody>
    
       <tr>
           <th style="width:20px;">
           <input type="checkbox" name="all" onclick="javascript:allselect(this, this.form.dimIvers)" />
           </th>
        <th>产品名称</th>
        <th>版本号</th>
        <th>状态</th>
        <th style="width:50px">
                         
  <button class="btn2" onClick="javascript:updateEvent()">批量设置</button>
                            </th>
                            <th style="width:50px">
                           <button class="btn2" onClick="javascript:resetEvent()">批量设置</button>
                            </th>
       </tr>
                 <c:forEach items="${dimIverList}" var="item" varStatus="index">
                       
                     <tr class="${index.count % 2 == 0 ? 'odd' : 'even' }">
                       <td>
                         <input type="checkbox" name="dimIvers" value="${item['product']},${item['iver']}"/>
                       </td>
                       <td>
                        ${item['description']}
                       </td>
                       <td>
                          <c:choose>
                           <c:when test="${item.iver=='null'}">全部</c:when>
                  <c:when test="${item.iver=='other'}">其他</c:when>
                  <c:otherwise>${item.iver}</c:otherwise>
                    </c:choose>
                       </td>
                       <td >
                        <c:if test="${item['status']==1}">线上 </c:if>
                        <c:if test="${item['status']==0}">线下 </c:if>
                       </td>

      
                       <td class="undefined">
                           <a class="btn2" href="${ctx}/dimIver/batchUpdateIver.do?product=${item['product']}&iver=${item['iver']}&dimIvers=${item['product']},${item['iver']}&status=1">设为线上</a>
                           </td>
                               <td class="undefined">
                           <a class="btn2" href="${ctx}/dimIver/batchUpdateIver.do?product=${item['product']}&iver=${item['iver']}&dimIvers=${item['product']},${item['iver']}&status=0">设为线下</a>
                           </td>
 
                    </tr>                          
                  </c:forEach>  
      </tbody>
     </table>
               
   </div>
   
                
    </form>
   
        <div class="grayr" id="pageList">
     <c:forEach items="${pagelist }" var="cp">
      <span class="<c:if test='${cp==pageNum}'>current</c:if>">
       <a href="getDimIverList.do?product=${product }&iver=${iver}&status=${status}&pageNum=${cp }">${cp }</a>
      </span>
     </c:forEach>                   
                   </div>   
                  
   <table class="none">
    <tr>
     <th>帮助信息</th>
    </tr>
    <tr>
     <td>
     <div class="help">
      <p></p>
     </div>
     </td>
    </tr>
   </table>
  </div>
  <!--{overview-->
 </div>
 <!--{home-->

 

 
</duowan:override>

 

<%@ include file="base.jsp" %>

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics