Web Analytics Made Easy -
StatCounter retreiving the value from a select dropdown - CodingForum

Announcement

Collapse
No announcement yet.

retreiving the value from a select dropdown

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • retreiving the value from a select dropdown

    how is a value accessed from a select dropdown, after an onchange is executed, using the launchurl script, from the
    newly launched page?

    code snippet:

    onchange="launchUrl('/IntChgAction.do');" >

    I want to access the selected value in the IntChgAction class.

  • #2
    To access a select menu's items:

    Code:
    document.MyformName.MySelectBoxName.options[document.MyformName.MySelectBoxName.selectedIndex].value;
    OR

    Code:
    document.getElementById('MySelectBoxID').options[document.getElementById('MySelectBoxID').selectedIndex].value;
    Both those examples grab the value from the selected option which must be declared.

    Code:
    <select id="menu1">
    <option value="2">February</option>
    </select>
    You can also access the text value by replacing .value with .text in the above examples (I know this at least works in IE not sure of other browsers)

    Hope That Helps,
    Basscyst
    Last edited by Basscyst; Feb 25, 2004, 07:07 PM.
    Helping to build a bigger box. - Adam Matthews

    Comment


    • #3
      I know this at least works in IE
      NS6 NS7 also.
      KOR
      Offshore programming
      -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

      Comment

      Working...
      X