Force a radio button selection

  • Thread starter Bill via DotNetMonster.com
  • Start date
B

Bill via DotNetMonster.com

Hi

I have a RadioButtonList and the value of each radio button is an image.

How can I arrange it so that clicking on an image selects the corresponding
radio button?

Thanks

Bill

<asp:RadioButtonList id="payment" runat="server"
RepeatDirection="Horizontal">
<asp:ListItem><a href="javascript:selRadioButton(0);"><img
src=images/Mastercard.png width="26" height="16" border="0"
alt="Mastercard&reg;"></a>&nbsp;&nbsp;</asp:ListItem>
<asp:ListItem><img src=images/Visa.jpg width="25" height="16"
border="0" alt="Visa&reg;">&nbsp;&nbsp;</asp:ListItem>
<asp:ListItem><img src=images/Bankcard.jpg width="25"
height="16" border="0" alt="Bankcard&reg;"></asp:ListItem>
</asp:RadioButtonList>
 
B

Bill via DotNetMonster.com

Trivial question, sorry. The answer is simply:

function selRadioButton(i) {
document.memberdetails.payment.checked=true;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top