日期:2014-05-16  浏览次数:20401 次

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&g