<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'list.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function (){
$("[value='全选']").click(function(){
$(".ch").attr("checked",true);
});
$("[value='全不选']").click(function(){
$(".ch").attr("checked",false);
});
$("[value='反选']").click(function(){
$(".ch").each(function(){
if($(this).attr("checked")){
$(this).attr("checked",false);
}else{
$(this).attr("checked",true);
}
});
});
});
</script>
</head>
<body>
<table>
<tr><input type="checkbox" class="ch"></tr>
<tr><input type="checkbox" class="ch"></tr>
<tr><input type="checkbox" class="ch"></tr>
<tr><input type="checkbox" class="ch"></tr>
<tr><input type="checkbox" class="ch"></tr>
<tr><input type="button" value="全选"></tr>
<tr><input type="button" value="全不选"></tr>
<tr><input type="button" value="反选"></tr>
</table>
</body>
</html>
一粒米养恩人,一石米养仇人