SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Aug 16, 2002, 11:56 #1
- Join Date
- Jan 2002
- Location
- Omaha, NE
- Posts
- 281
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How do you get the text out of a drop down box?
Is there a way access the display text of a dropdown box in javascript? I can get the value of the dropdown, but I need to use the display text in the confirm portion of the javscript. Any ideas? I tried selectform.Player.text, but that gives me an undefined error, the code works with selectform.Player.value
thanks!
Code:<script language="JavaScript"> function VerifySelect(selectform) { textvalue = "Are you sure you want to select: " + selectform.Player.text; if (confirm(textvalue)) { selectform.submit(); } } </script>
-
Aug 16, 2002, 12:22 #2
- Join Date
- Jan 2002
- Location
- Omaha, NE
- Posts
- 281
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Got it!!!!!
I did some more searching and some trial and error and got it! it doesn't seem very clean, but it works!!!
Code:<script language="JavaScript"> function VerifySelect(selectform) { textvalue = "Are you sure you want to select: " + selectform.Player.options[selectform.Player.options.selectedIndex].text; if (confirm(textvalue)) { selectform.submit(); } } </script>
This site really helped!
http://www.javascriptkit.com/javatutors/combos4.shtml
Bookmarks