If I've understood your problem then I would approach it this way. I'd create a variable, in a separate
js file if you wish, that looks something like:
Code:
var DDLOptions = {
a: [{value: "option 1 value", text: "option 1 text"},
{value: "option 2 value", text: "option 2 text"},
{value: "option 3 value", text: "option 3 text"}],
b: [{value: "option 1 value", text: "option 1 text"},
{value: "option 2 value", text: "option 2 text"},
{value: "option 3 value", text: "option 3 text"}],
//....
z: [{value: "option 1 value", text: "option 1 text"},
{value: "option 2 value", text: "option 2 text"},
{value: "option 3 value", text: "option 3 text"}]
}
You can the access the options for a particular letter via:
Code:
var oOptions = DDLOptions.a
//or
var oOptions = DDLOptions[a]
which gives an array of option data.
You then iterate through this array and create an option for each element using
Code:
oOptions[i].value and oOptions[i].text
where i represents the index of the current option. These are added to the empty select element that resides on the page.
Alternatively you could do this sort of processing server-side, it depends on how your web application works.
--
Joe (
Microsoft MVP - XML)