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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Valuers de boutons radios</title>
<script type="text/javascript">
//<!--
function showsel(ok){
if(ok){
selection=getRadioValue("ville")+"<br/>"+getRadioValue('autre')
document.getElementById('choix').innerHTML=selection
}
}
function getRadioValue(rname){
colradio=document.getElementsByName(rname)
var i=-1;
while( colradio[++i]){
if(colradio[i].checked){ return colradio[i].value;}
}
return ''
}
//-->
</script>
</head>
<body>
<p>
<input type='radio' name="ville" value="Paris" id="Paris" onclick="showsel(this.checked)" /><label for="Paris" >Paris</label><br/>
<input type='radio' name="ville" value="Montreal" id="Montreal" onclick="showsel(this.checked)" /><label for="Montreal" >Montreal</label><br/>
<input type='radio' name="ville" value="Londres" id="Londres" onclick="showsel(this.checked)" /><label for="Londres" >Londres</label><br/>
<input type='radio' name="ville" value="Chipre" id="Chipre" onclick="showsel(this.checked)"/><label for="Chipre" >Chipre</label><br/>
<br/>
<input type='radio' name="autre" value="test1" id="test1" onclick="showsel(this.checked)" /><label for="test1" >test 1</label><br/>
<input type='radio' name="autre" value="test2" id="test2" onclick="showsel(this.checked)"/><label for="test2">test 2</label><br/>
<input type='radio' name="autre" value="test3" id="test3" onclick="showsel(this.checked)" /><label for="test3" >test 3</label><br/>
<input type='radio' name="autre" value="test4" id="test4" onclick="showsel(this.checked)" /><label for="test4" >test 4</label><br/>
<br/>
</p>
<div id="choix"></div>
</body>
</html> |
Partager