SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: LIST/MENU reading selected item
Hybrid View
-
May 21, 2001, 01:29 #1
- Join Date
- Mar 2001
- Location
- the Netherlands
- Posts
- 519
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I have filled a LIST/MENU with dynamic content.
The value of an <option> is a number (id)...
How can I read out which item is selected when the form is submitted?
-
May 21, 2001, 06:45 #2
- Join Date
- Feb 2001
- Location
- Van down by the river
- Posts
- 254
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I assume you're not using anything server side to get the value since this is posted in the client side forum?
JavaScript can get the value of a select menu like this:
document.formName.selectName[document.formName.selectName.selectedIndex].value
You could use an onSubmit event handler in your form tag to call a function and get the menu's value, performing an action depending on what option was selected.
Bookmarks