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 48 49 50 51 52 53 54 55 56
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nouvelle page 1</title>
<script type="text/javascript">
<!--
var numCheck = 0;
var checkMax = 5;
function testCheck(obj)
{
numCheck=0
var checkSetName=obj.name
var checkSet=document.getElementsByName(checkSetName)
for (i=0;i<checkSet.length;i++){
if (checkSet[i].checked){
numCheck++;}
if (numCheck>checkMax) {
alert("Vous pouvez indiquer jusqu'à 5 spécialités.");
obj.checked = false;
}
}
document.getElementById("idOut").innerHTML = numCheck +" cases cochées";
}
//-->
</script>
</head>
<body>
<input type="checkbox" name="specialite" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="specialite" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="specialite" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="specialite" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="specialite" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="specialite" value="1" onclick="testCheck(this)";><br/>
<input type="checkbox" name="aa" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="aa" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="aa" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="aa" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="aa" value="1" onclick="testCheck(this)";>
<input type="checkbox" name="aa" value="1" onclick="testCheck(this)";>
<div id='idOut'></div>
</body>
</html> |
Partager