retrive radiobutton selected value using vbscript

eagle_ea
eagle_ea used Ask the Experts™
on
please help me with the below code.
trying to print the selected radio button value
<HTML>
<HEAD><TITLE>A Simple First Page</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Button1_OnClick

 MsgBox myform.q1.checked.toString()

End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H3>A Simple First Page</H3><HR>
<FORM name=myform>

<input type="radio" name="q1" value="status" checked=checked/> Check Status<br />
<input type="radio" name="q1" value="stop" /> Stop Sitesee<br />
<input type="radio" name="q1" value="start" /> Start Sitesee<br />
<input type="button" name="button1" value ="Select Option" >

</FORM>
</BODY>
</HTML>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
q1.value will be the value of whatever is checked.

Author

Commented:
error:
object required 'q1'
I believe this is what you are looking for...
sew

If document.myform.q1(0).checked Then
	msgbox "selected status"
ElseIf document.myform.q1(1).checked Then
	msgbox "selected stop"
ElseIf document.myform.q1(2).checked Then
	msgbox "selected start"
Else
	msgbox "error"
End If

Open in new window

Author

Commented:
that worked . thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial