access listbox in onchange event
Hello
I've googled for hours, but cannot find an answer to this problem, i'm
getting on in coding land now so I know its an obvious solution, but can't
figure out the vbscript syntax is?
- I have a listbox, populated (cb_CountryList) on a page startup with a DB.
- I want the onchange event to open a new window (Test_1-resultspage.asp)
based on the index of the selected item value (passed in query string)
- The Onchange event therefore must reference the list box that has not been declared yet
- This doesn't compile. I've also tried full path declaration e.g. this.frmCountryListBox.cb_CountryList.SelectedInde x, and putting the onchange event in the form rather than the list box definition
nothing seems to work
any quick pointers appreciated?
many thanks
Oz
<form action="" method="post" name="frmCountryListBox" onchange="window.open('Test_1-resultspage.asp?How=ById&CountryIndex=<%cb_Country List.SelectedIndex%>')" target="pop" >
<select name="cb_CountryList" id="cb_CountryList" >
<%
While (NOT rs_CountryList.EOF)
%>
<option value="<%=(rs_CountryList.Fields.Item("Country").V alue)%>"><%=(rs_CountryList.Fields.Item("Country") .Value)%></option>
<%
rs_CountryList.MoveNext()
Wend
If (rs_CountryList.CursorType > 0) Then
rs_CountryList.MoveFirst
Else
rs_CountryList.Requery
End If
%>
</select>
</form>
|