<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2712.300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV>Here's one: </DIV>
<DIV> </DIV>
<DIV>I've got a function that I use to identify which radio button a user
selects. It works great if you have more than one radio button in the
group.</DIV>
<DIV> </DIV>
<DIV>My problem is that my radio buttons are dynamically generated, and
sometimes only one radio button is in the group.</DIV>
<DIV> </DIV>
<DIV>Can someone see what the problem is which my function, get_radio_value()?
To make the snippet below work correctly, uncomment the second radio
button.</DIV>
<DIV> </DIV>
<DIV>Best,</DIV>
<DIV> </DIV>
<DIV>Bill</DIV>
<DIV> </DIV><script language=javascript><BR><!--<BR>function
get_radio_value (radio_array)<BR>{<BR> var i;<BR> for (i = 0; i <
radio_array . length; ++ i)<BR> if (radio_array [i] .
checked)<BR> return radio_array [i] . value;<BR> return
null; <BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>function run_choice() {<BR> document.write(
get_radio_value(sel.radiobutton) )<BR> document.write("<p><input
type=button value=Back")<BR> document.write("
onClick='history.back()'>")<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>//--><BR></script><BR><form name=sel
method=post><BR> <input type="radio"
name="radiobutton" value="01003">01003<BR>
<!-- input type="radio" name="radiobutton" value="01004">01004
--></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> <p><input
type=button name=ok value=OK
onClick='run_choice()'><BR></form><BR></FONT></DIV></BODY></HTML>