javascript to populate ddl

using javascript, i have to populate a dropdownlist text and its values.
for that i am getting name and its values in two variables namely "name" and "id".

the ddl text is populated using this code,
document.Auto.ddlComp.options[i] = new Option(name); // working fine

but to populate its correspoding values for text i used,
// document.Auto.ddlComp.options[i].value = new Option(id);

its not working. please tell me how to populate the corresponding ddl values to its text.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!