フォームアクション
2780 ワード
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>test</title>
<!--<link type="text/css" rel="stylesheet" href="css/head.css" />-->
<style type="text/css">
.focus {
border:1px solid #f00;
background:#fcc;
}
</style>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
</head>
<body>
<form action="" method="post">
?
<input type="checkbox" id="checkedAll" /> / <br />
<input type="checkbox" name="item" value=" " />
<input type="checkbox" name="item" value=" " />
<input type="checkbox" name="item" value=" " />
<input type="checkbox" name="item" value=" " /> <br/>
<input type="button" id="checkedRev" value=" " />
<input type="button" id="send" value=" " />
</form>
<script type="text/javascript">
$(function(){
$('#checkedAll').click(function(){
$(':checkbox[name=item]').attr('checked',this.checked);
});
/*$(':checkbox[name=item]').click(function(){
var flag=true;
$(':checkbox[name=item]').each(function(){
if(!this.checked){
flag = false;
}
});
$('#checkedAll').attr('checked',flag);
});*/
$(':checkbox[name=item]').click(function(){
var ck_leg = $(':checkbox[name=item]').filter(':checked').length;
$('#checkedAll').attr('checked',$(':checkbox[name=item]').length==ck_leg);
});
$('#checkedRev').click(function(){
$(':checkbox[name=item]').each(function(){
this.checked=!this.checked;
});
});
$('#send').click(function(){
var str = " :" + '\r
';
$(':checkbox[name=item]:checked').each(function(){
str += $(this).val() + '\r
';
});
alert(str);
});
})
</script>
</body>
</html>