At the end of the page... you want to make sure this doesn't execute until
after the <select> has loaded.
Something like this... see a JavaScript newsgroup for better syntax and
examples (the only ASP-related part here is getting the ASP variable into
client-side script).
<script>
var selected = 0;
for (i=0; i<document.frm. cmbList.options .length; i++)
{
if (document.frm.c mbList.options[i].value ==
"<%=request.for m("cmbList")%>" )
{
selected = i;
i = document.frm.cm bList.options.l ength;
}
}
document.frm.cm bList.selectedI ndex = selected;
</script>
You could also consider building the select list in ASP, e.g.
<%
dim options(3)
options(0) = "foo"
options(1) = "bar"
options(2) = "fu"
options(3) = "barred"
response.write "<select>"
for i = 0 to 3
response.write "<option value='" & options(i) & "'"
if options(i) = request.form("c mbList") then
response.write " selected"
end if
response.write ">" & options(i)
next
response.write "</select>"
%>
"K. Lobe" <no*********@sn sc.com> wrote in message
news:eD******** ******@TK2MSFTN GP11.phx.gbl...
list box based on a POST method to the same page.
frm.cmbList.Val ue=Request.Form ("cmbList") doesn't work.
When the page loads, it reloads the <SELECT>, so not sure how to get the
list to go to the item.
Any ideas?
many thnx,
Kevin