faqts : Computers : Programming : Languages : JavaScript

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

1 of 1 people (100%) answered Yes
Recently 1 of 1 people (100%) answered Yes

Entry

How to dynamically add data to the select based on the result of select query

Apr 8th, 2008 18:34
ha mo, Dave Clark, Satyanarayana Voleti,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Satyanarayana,
     This is not a JavaScript question -- unless you're referring to 
using AJAX to call a server-side script to perform the query you 
mentioned.  Otherwise, the following is how to use JavaScript to add 
an OPTION to an HTML SELECT element:
var opt = document.forms['formName'].elements['selectName'].options;
opt[opt.length] = new Option(opt_text, opt_value, false, false);
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com