fraser5002
Mar 29th 2005, 6:01 am
hi after having been giving great help the othe rday i have one more problem i would like to ask about. im trying to use a function to work out which radio button has been selected. I dont really fully understand functions so i hope i have set this out right . Anyway its not working and errors appear on the page.
am i close?
<form name="payment">
<div align="center">
<table border="0" height="74" width="371">
<tr>
<td height="12" width="600">
<p align="right"><font size="2">I'm buying a £0.50 photo
(1600 x 1200)</font></p>
</td>
<center>
<td height="12" width="26"><input type="radio" value="V1" checked name="R1"></td>
<td height="12" width="29"> </td>
</tr>
</center>
<tr>
<td height="25" width="600">
<p align="right"><font size="2">I'm buying a £1.00 photo (2048
x 1536)</font></p>
</td>
<center>
<td height="25" width="26"><input type="radio" name="R1" value="V2"></td>
<td height="25" width="29"><font size="2">
<img border="0" src="x-click-but23.gif" align="center" width="68" height="23" onclick="decision(<V1>,<V2>,<V3>)">
</font></td>
</tr>
</center>
<tr>
<td height="25" width="600">
<p align="right"><font size="2">I'm buying a Image CD costing
£6.00</font></p>
</td>
<center>
<td height="25" width="26"><input type="radio" name="R1" value="V3"></td>
<td height="25" width="29"></td>
</tr>
</table>
</center>
</div>
<p align="center"><font size="2">
</font>
</p>
<script type="text/javascript">
<!--
function decision(V1,V2,V3){
if(document.form.V1.checked) {
window.alert("test");
} else if(document.form.V2.checked) {
window.alert("test");
} else if(document.form.V3.checked) {
window.alert("test");
} else {
window.alert("Pick something!!");
}
}// -->
</script>
</form>
thanks again
am i close?
<form name="payment">
<div align="center">
<table border="0" height="74" width="371">
<tr>
<td height="12" width="600">
<p align="right"><font size="2">I'm buying a £0.50 photo
(1600 x 1200)</font></p>
</td>
<center>
<td height="12" width="26"><input type="radio" value="V1" checked name="R1"></td>
<td height="12" width="29"> </td>
</tr>
</center>
<tr>
<td height="25" width="600">
<p align="right"><font size="2">I'm buying a £1.00 photo (2048
x 1536)</font></p>
</td>
<center>
<td height="25" width="26"><input type="radio" name="R1" value="V2"></td>
<td height="25" width="29"><font size="2">
<img border="0" src="x-click-but23.gif" align="center" width="68" height="23" onclick="decision(<V1>,<V2>,<V3>)">
</font></td>
</tr>
</center>
<tr>
<td height="25" width="600">
<p align="right"><font size="2">I'm buying a Image CD costing
£6.00</font></p>
</td>
<center>
<td height="25" width="26"><input type="radio" name="R1" value="V3"></td>
<td height="25" width="29"></td>
</tr>
</table>
</center>
</div>
<p align="center"><font size="2">
</font>
</p>
<script type="text/javascript">
<!--
function decision(V1,V2,V3){
if(document.form.V1.checked) {
window.alert("test");
} else if(document.form.V2.checked) {
window.alert("test");
} else if(document.form.V3.checked) {
window.alert("test");
} else {
window.alert("Pick something!!");
}
}// -->
</script>
</form>
thanks again