Click to See Complete Forum and Search --> : list in javascript


hugsdan
May 23rd, 2003, 09:42 AM
i have a liste of size=1, i need a program to refresh the page to get a value and after to have the selected value i want in the list

example: i have 'default','A', 'B', 'C' in my list, i choose 'A', the form is submitted and the selected String is now 'default' because of the refresh, so i want to have 'A' as selected,

how can i do?

(sorry for my english)

Branko
May 23rd, 2003, 12:35 PM
Hello,

jump to the page with a var like this:

mypage.asp?myvar=5

(supose five is the index of your list item)

and in the list in your page put a code like the following:


<%myvar=request.queryString("myvar")%>

<SELECT id=mylist>
<option value=1 <%if myvar=1 then%>SELECTED<%End if%> >default</option>
<option value=2 <%if myvar=2 then%>SELECTED<%End if%>>B</option>
<option value=3 <%if myvar=3 then%>SELECTED<%End if%>>C</option>
<option value=4 <%if myvar=4 then%>SELECTED<%End if%>>D</option>
<option value=5 <%if myvar=5 then%>SELECTED<%End if%>>A</option>
</SELECT>


It's kind of messy but I hope you understand it.

bye

hugsdan
May 26th, 2003, 04:59 AM
it's ok, thanks