Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio button values

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm having trouble understanding how to access the value of a group of radio buttons using vbscript. How do I determine which one is selected?

Thanks
 
Here's a example from

should get you going

<HTML>
<HEAD>
<TITLE>Using radio buttons</TITLE>
</HEAD>

<BODY BGCOLOR=&quot;#FFFFFF&quot;>

<FONT FACE=&quot;Verdana, Arial, Helvetica&quot; SIZE=2>
<SCRIPT LANGUAGE=&quot;VBSCRIPT&quot;>
<!--
Sub Button1_onclick
Dim x

For x = 0 to 6
If Form1.elements(x).checked = True Then
top.document.bgColor = Form1.elements(x).value
End If
Next
End Sub
-->
</SCRIPT>
</FONT>

<FONT FACE=&quot;Verdana, Arial, Helvetica&quot; SIZE=2>

<FORM NAME=&quot;Form1&quot;><B>Please choose your favorite color</B>
<BR><INPUT TYPE=RADIO NAME=&quot;rdoColor&quot; VALUE=&quot;White&quot; CHECKED> White
<BR><INPUT TYPE=RADIO NAME=&quot;rdoColor&quot; VALUE=&quot;Red&quot;> Red
<BR><INPUT TYPE=RADIO NAME=&quot;rdoColor&quot; VALUE=&quot;Green&quot;> Green
<BR><INPUT TYPE=RADIO NAME=&quot;rdoColor&quot; VALUE=&quot;Blue&quot;> Blue
<BR><INPUT TYPE=RADIO NAME=&quot;rdoColor&quot; VALUE=&quot;Magenta&quot;> Magenta
<BR><INPUT TYPE=RADIO NAME=&quot;rdoColor&quot; VALUE=&quot;Yellow&quot;> Yellow
<BR><INPUT TYPE=RADIO NAME=&quot;rdoColor&quot; VALUE=&quot;Purple&quot;> Purple
<BR><INPUT TYPE=BUTTON NAME=&quot;Button1&quot; VALUE=&quot;Ready&quot;>
</FORM>


<P><HR WIDTH=100% SIZE=1 COLOR=&quot;ORANGE&quot;>
Choose <I>View</I> then <I>Source</I> in Internet Explorer to see source code.
</FONT>

</BODY>

</HTML> [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top