I can't seem to get an "onclick" to work right when placed inside a <option> tag in the following scenario.
(I use classic asp, VBScript, and javascript.)
I want to populate 2 dropdowns (list boxes) with items (file names with extendion, e.g., address.asp, contact.asp, etc.) from a SQLsever db inside a .asp file. I then want the user to click on an item in either listbox and to then programmatically open the selected .asp in a new browser window.
The following code does the db Select's ok and does populate the 2 listboxes with the fielnames but when I click an item in a listbox I can't seem to get it to "open" the selected .asp. Here's the code:
=== === === === === === === ===
code to do the sQL Select from the db...then...
Response.Write "<center><form method=post name='propsearch' id='propsearch' action='#'>"
Response.Write "<center><tr><td height=""20"" width=""25%"" valign=""middle"" align=""center"" >"
Response.Write "<select name='propstyle' id='propstyle' >"
Response.Write "<option value='' SELECTED>Select a webpage</option>"
Do While Not oRS.EOF
Response.Write "<option value='" & oRS("Page_Name") & "'>" & oRS("Page_Name") & "</option>"
oRS.MoveNext
Loop
oRS.MoveFirst
' now complete the <select> on listbox 1
Response.Write "</select>"
Response.Write "</td>"
Response.Write "<td height=""20"" width=""25%"" valign=""middle"" align=""center"" >"
' set up to do listbox #2
Response.Write "<select name='ptype2' id='ptype2'><option value='' SELECTED>Select a webpage</option>"
Do While Not oRS.EOF
'Response.Write "<select name='propstyle' id='propstyle' onchange='populateTheThird
Dropdown(t
his.option
s[this.sel
ectedIndex
].value)'>
"
Response.Write "<option value='" & oRS("Page_Name") & "'>" & oRS("Page_Name") & "</option>"
'Response.Write "<option value='" & oRS("Page_Description") & "'>" & oRS("Page_Description") & "</option>"
oRS.MoveNext
Loop
oRS.Close
' complete 2nd listbox
Response.Write "</td></tr></table>"
Response.Write "</form></center>"
=== === === === === === ===
Start Free Trial