この機能が起動しない理由がわかりません。それをチェックして、SOでたくさん読んで、何も...どこかに非常に小さな間違いがあると確信しています..
<form id="order">
<table>
<tr>
<td>
What type of pica would you like?<br>
Vegetarian, £6.50 <input type="radio" name="pica" onclick="calcul();" value="vegetarian"><br>
Meat Lover, £7.20 <input type="radio" name="pica" onclick="calcul();" value="meatLover"><br>
Hawaian, £5.5 <input type="radio" name="pica" onclick="calcul();" value="hawaian">
<br><br>
</td>
</tr>
</table>
</form>
var picaPrice = new Array();
picaPrice['vegetarian']=6.5;
picaPrice['meatLover']=7.2;
picaPrice['hawaian']=5.5;
function calcul(){
var pprice = 0;
var selectedPica = document.getElementsByName('pica');
for(var i=0; i<selectedPica.length; i++){
if(selectedPica[i].checked) {
alert('selected');
}
else { alert('not selected') }
}
}
終わり。ご協力ありがとうございました