标签:http java io cti html javascript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.6.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#ckall").click(function(){
var flag = $(this).attr("checked");
// alert(flag);
if(!flag)
$("[name = ck]:checkbox").attr("checked",false);
else
$("[name = ck]:checkbox").attr("checked",true);
});
//全选后,取消某个选中后,全选的checkbox取消选中状态
$("[name=ck]:checkbox").click(function(){
var flag = true;
$("[name=ck]:checkbox").each(function(){
if(!this.checked)
{
flag = false;
}
});
$("#ckall").attr("checked",flag);
});
});
</script>
</head>
<body>
<input type="checkbox" id="ckall" />
<input type="checkbox" name="ck" />
<input type="checkbox" name="ck" />
<input type="checkbox" name="ck" />
<input type="checkbox" name="ck" />
</body>
</html>
标签:http java io cti html javascript
原文地址:http://www.cnblogs.com/gogood/p/3837137.html