Forum Moderators: open

Message Too Old, No Replies

Initially render an HTML select box midway through its vertical list

40 options in list... how do I start the select box midway through the list

         

Thanasus

7:25 am on Feb 17, 2004 (gmt 0)

10+ Year Member



I am having a simple problem I cannot get around. I have an HTML select box with about 40 options. I would like to have the select box default to a selected value which is 22 in the list. I have a height of 6.

The problem is I would like the user to immediately see the defaulted value without having to scroll down to option 22. I don't want to make option 22 an earlier option because the options are in alphabetical order.

Any ideas?

tombola

8:06 am on Feb 17, 2004 (gmt 0)

10+ Year Member



Try this:

<option name="name">Item #1</option>
...
<option name="name">Item #21</option>
<option name="name" selected>Item #22</option>
<option name="name">Item #23</option>
etc.

Thanasus

9:20 am on Feb 17, 2004 (gmt 0)

10+ Year Member



Thats essentially what I have but the browser (IE) starts at the top of the list.

DrDoc

5:10 pm on Feb 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does it work if you make it size 1?

photon

7:51 pm on Feb 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Depending on your DOCTYPE you might need to have
<option name="name" [b]selected="selected"[/b]>Item #22</option>
.