1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
<!-- Script initialisation jquery -->
<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
countSelect();
$(':checkbox').click(function(){
countSelect();
});
$('#selectAll').click(function(){
var check = $(".select");
if(this.checked)
{
check.attr('checked', true);
} else {
check.attr('checked', false);
}
countSelect();
});
function countSelect(){
$("#countSelect").html($(".select").filter(":checked").length + " enregistrements sélectionnés");
};
});
</script>
</head>
<body>
<p>check all : <input id="selectAll" type="checkbox"/></p>
<p>autres :
<input id="1/1/1" class="select" type="checkbox"/>
<input id="1/1/2" class="select" type="checkbox"/>
<input id="1/1/3" class="select" type="checkbox"/>
<input id="1/1/4" class="select" type="checkbox"/>
<input id="1/1/5" class="select" type="checkbox"/>
</p>
<p id="countSelect"></p>
</body>
</html> |
Partager