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
|
<html>
<head>
<title>test</title>
<script type="text/javascript">
function verif(frm) {
var elts= frm["cases[]"];
var test= false;
for(var i=0; i<elts.length; i++)
if(elts[i].checked) test= true;
if(!test) alert("il faut cocher au moins une checkbox !");
return test;
}
</script>
</head>
<body>
<form method="post" action="" onsubmit="return verif(this)">
<input type="checkbox" name="cases[]" value="1"/>
<input type="checkbox" name="cases[]" value="2"/>
<input type="checkbox" name="cases[]" value="3"/>
<input type="submit" name="sub" value="test !" />
</form>
</body>
</html> |