Results 1 to 4 of 4

Thread: Javascript: Form Menu Boxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Posts
    10

    Question Javascript: Form Menu Boxes

    Hello,

    I am trying to extract the selected value from a menu box on a form, so I can use the value in a function.

    In my function, I am currently using:
    function1 {
    var1 = theform.select1.text
    ...
    }

    I am calling the function as follows:
    <select name="select1" ... onchange = "function1(this)" >

    but var1 is not filling with any values

    Also I need to be able to extract a value from a radio button group.
    If the group is called RadioGroup1 and there are a number of radio buttons in the group.
    To get the value of the button selected would it be
    RadioGroup1.value or some other syntax.

    Any ideas would be appreciated .
    Thanks
    Thanks

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    if s is the select, you get the selected value with s.options[s.selectedIndex].value.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    or s.value
    Have I helped you? Please Rate my posts.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Posts
    10
    Thanks for that ,

    One other question.
    if I have 3 radio buttons , how would I - when I click on any of them I want to call a function and assign the radio button value to a variable.

    I have no problem calling the function with the onClick event, but I cant seem to distinguish between the 3 buttons.

    Was trying RadioGroup1[RadioGroup1.checked].value but it doesnt seem to work.

    Any ideas appreciated.

    Thanks
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width