#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    6
    Rep Power
    0

    Unhappy text box and radio buttons doesn't work together??


    I try to change "checked" property of the radio buttons when I click on the text box.
    Here is my code:

    <form name="form1" method="post" action="response.asp">
    <input type="radio" name="radiosample" checked>Sample #1<br>
    <input type="radio" name="radiosample">Sample #2<br>
    <input type="radio" name="radiosample" >Sample #3<br>
    <input type="text" size="20" name="text_box" onClick="Check_radio()">
    </form>

    <script language="vbScript">
    Sub Check_radio()
    form1.radiosample.checked(2)= True
    End Sub
    </script>

    I am getting an error: "Object doesn't support this property or method "form1.radiosample.checked'.

    What is wrong?

    I would appreciate any help!
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    6
    Rep Power
    0
    Hi mate,

    You just have the syntax slighty wrong. Here you go:

    <script language="vbScript">
    Sub Check_radio()
    form1.radiosample(2).checked= True
    End Sub
    </script>

    The index for an array starts at 0 so, in your example, radiosample(2) points to the 3rd radio button in the group.

    Andrew
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    6
    Rep Power
    0

    Talking


    Yes!!!!! I got it!

    Thank you so much!!!

IMN logo majestic logo threadwatch logo seochat tools logo