faqts : Computers : Programming : Languages : JavaScript : Forms : SELECT

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

46 of 57 people (81%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How do you use a selected value from a list as input to another function. e.g. price("value") * quantity ("new variable") = "Cost"

Mar 6th, 2001 15:12
B Kez, Jim Baird,


The function the needs the value of the selected option can reference 
that information with this javascript:
document.FormName.SelectName.options
[document.FormName.SelectName.options.selectedIndex].value;
You could also reference the selected option's text with this:
document.FormName.SelectName.options
[document.FormName.SelectName.options.selectedIndex].text;