Select activable avec des boutons radio (IE :S)
Bonjour,
je voudrais faire en sorte que lorsque je clique sur un bouton radio, un select s'active ou se désactive. Mais sous IE, problème : on est obligé de cliquer a côté du champ pour que l'effet ait lieu sur le select.
Code:
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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<script type="text/javascript" >
function activateField()
{
var select = document.getElementById("select");
select.disabled = false;
}
function disactivateField()
{
var select = document.getElementById("select");
select.disabled = true;
}
</script>
</head>
<body>
<select id="select" disabled >
<option id="rightLevel1" value="0">Value 1</option>
<option id="rightLevel2" value="1">Value 2</option>
<option id="rightLevel2" value="2">value 3</option>
</select>
<span>
<input id="inherit1" name="inherit" type="radio" value="0" onchange="activateField()" />activated
<input id="inherit2" name="inherit" type="radio" value="1" checked="checked" onchange="disactivateField()" />disactivated
</span>
</body>
</html> |
Merci a vous,
et bonne journée