bouton radio sans formulaire
bjr,
Je ne sais pas quoi transmettre comme paramètre à la fonction testerRadio()
Quelqu’un peut il m'aider !
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
| <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<script>
function testerRadio( radio ){
for( var i=0 ; i<radio.length ; i++ ){
if ( radio[i].checked ){
document.getElementById("cible").firstChild.nodeValue = radio[i].value;
}
}
}
</script>
</head>
<body>
<p id="cible">null</p>
<p onClick="testerRadio( ???? )">
<label>
<input type="radio" name="RG" value="1">
b1</label>
<label>
<input type="radio" name="RG" value="2" checked="checked">
b2</label>
</p>
</body>
</html> |