That is a good example, it's a variation on what I was trying to show you, so you can go with that. What you need to do is dynamically produce the bit where the new options are added.
So go back to ordering your recordset by Category,Sub-Category.
create the jsOut variable below while looping through the recordset to create the category dropdown.
i=-1
j=0
currentCategory = ""
jsOut = ""
while not recordset.eof
if recordset("Category") <> currentCateggory then
'Write your Category option here
'
' Category option code
'
'CODE TO WRITE THE
JS
'Close the previous if statement if not the first one
if i >= 0 then
jsOut = jsOut & "}" & vbNewLine
end if
'increment i and reset j
i = i + 1
j=0
'write the
js if statement to the variable
jsOut = jsOut & "if (index == " & i & "){" & vbNewLine
end if
'write the sub-cat as a new option within the
js if.
jsOut = jsOut & "options[" & j & "]=new Option(""" & recordset("Sub-Category") & """);" & vbNewLine
'increment j
j = j + 1
wend
'close the last
js if statement
jsOut = jsOut & "}"
Then where the example had the code
if (Indx==1){
options[0]=new Option("Choose a JavaScript Page","");
options[1]=new Option("Alerts","alerts.htm");
options[2]=new Option("Back and Forward Buttons","BackForward.htm");
options[3]=new Option("Contents","index.html");
}
You write
<%= jsOut%>
Give that a try and let me know if you have any drama
======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================