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

js全选和批量删除
  js代码
<script type="text/javascript">
	function selectAll(){
		for(var i=0;i<document.form1.selectList.length;i++){
			var until=document.form1.selectList[i];
			until.checked=document.form1.selected.checked;
		}
	}
	function testSelect(){
	 var select=false;
	 for(var i=0;i<document.form1.selectList.length;i++){
	 	if(document.form1.selectList[i].checked){
	 	 select=true;
	 	 break;
	 	}
	 }
	 if(!select){
	 alert("你还没选择要删除的记录!");
	 }
	 return select;
	}
	function ss(){
	alert("hello");
	}
</script>
html:
<form  action="/deleted.jspx?method=listDelete" name="form1" id="form1" onsubmit="return testSelect();" method="post">
 <table  border="1" class="font">
  	<tr><td><input type="checkbox" id="selected" name="selected" onclick="selectAll();"/>序号</td><td width="10%">问题摘要</td><td >问题类型</td><td > 评审意见</td>
  	 <td>操作</td>
  	 </tr>
  	<#list list as pro>
  	 <tr>
  	 <td><input id="selectList" name="selectList" type="checkbox" value="${pro.proId}"/>${pro_index+1}</td>
  	 <td>${pro.proDescrible}</td>
  	 <td>${pro.proType }</td>
  	 <td>${pro.review.content}</td>
  	 <td>
  	 	<a href="/query.jspx?proId=${pro.proId}">查看</a>
  	 	<a href="/delete.jspx?proId=${pro.proId}" onclick='return(confirm("确定删除?"));'>删除</a>
  	 </td>
  	 </tr>
    </#list>
   </table>?

?