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
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>[...]</title>
<script type="text/javascript">
function checkAllBox( obj){
alert( 'value : ' +obj.value +'\nlastChild : ' +obj.parentNode.lastChild.data);
var boxes = document.info.box.length;
for (i = 0; i < boxes; i++){
if(!document.info.box[i].checked){
//alert("Contrôle incomplet !!");
document.info.box[i].focus();
return false;
}
}
return true;
}
</script>
</head>
<body>
<form name="info">
<label><input type="checkbox" name="box[]" value="Nom (1)" onclick="checkAllBox(this)">Nom (1)</label>
<label><input type="checkbox" name="box[]" value="Nom (2)" onclick="checkAllBox(this)">Nom (2)</label>
<label><input type="checkbox" name="box[]" value="Nom (3)" onclick="checkAllBox(this)">Nom (3)</label>
</form>
</body>
</html> |