Forum Moderators: open

Message Too Old, No Replies

Number of Options in Select Tag

How can you turn the scrolling off?

         

ecardiff

10:41 am on Jul 25, 2002 (gmt 0)

10+ Year Member



Does anyone know if it is possible to control when scrolling starts within a select tag? I have multiple off (only one selection), so size doesn't seem to work.

Basically, I have a select tag with 12 options (months of the year) and I'd prefer to show all 12 at once rather than scrolling one place at either end of the list. Any ideas? Thanks.

aspdaddy

12:48 pm on Jul 25, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi ecardiff,

afaik you cant do this - the size is always proportional to the font-size attribute.

smokin

1:22 pm on Jul 25, 2002 (gmt 0)

10+ Year Member



<SELECT size=4 id=select1 name=select1>
<OPTION>ryryrt</OPTION>
<OPTION>ryryrt</OPTION>
<OPTION>ryryrt</OPTION>
</SELECT>

will work

isNaN

1:22 pm on Jul 25, 2002 (gmt 0)

10+ Year Member



yes u can by specify the size to the size attribute.

<select name="test" size="12">
<option value="1" SELECTED>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>

is that what u intend to do?

smokin

1:23 pm on Jul 25, 2002 (gmt 0)

10+ Year Member



sorry that should be size=12

ecardiff

1:53 pm on Jul 25, 2002 (gmt 0)

10+ Year Member



Thanks for the replies. I don't think I've explained this too well.
I only want to show one line in my select to start with. There are 12 options.

When you click on it, the dropdown list unfolds but rather than showing all 12, there are 11 and you have to scroll between seeing January and seeing December.

What I was wondering was if there was a way to show all 12 without scrolling, when you click on the arrow, not showing all 12 options to start with. It's just me being pernickity!

I have thought of a way: Having 2 selects, and hiding the second with layers or z-index dependent upon the browser. Set the size property to 12 on the second and disable the first.
On the First's onClick event bring the second to the front. And on the
seconds on click event hide it and feed the selected value through to the first.

Far too much hassle though!! I just thought there might be "scrolling:no" or similar.

Thanks again.

rewboss

8:17 am on Jul 26, 2002 (gmt 0)

10+ Year Member



It's up to the browser, and basically, no, you can't do much about it. There's an excellent reason for that: imagine you have not 12, but 120 options, and turned scrolling off. How would anyone using a normal-sized screen get to see all of the different options?

With only 12 options that ought not to be an issue. But it's still not a good idea to try it.

ecardiff

8:57 am on Jul 26, 2002 (gmt 0)

10+ Year Member



Thanks for that, but I don't want 120 options I want 12.

I'm sure there are plenty of things that a poor web designer could do to throw a browser, if incorrect and ill-thought-out settings were applied in a page.

It's only because I would prefer to see all 12 items at once and can't see any reason to scroll at 11 items. Doesn't that make sense?

rewboss

2:46 pm on Jul 26, 2002 (gmt 0)

10+ Year Member



It makes perfect sense to me, but that's because I'm a human. Browsers aren't human, so they don't "know" how silly it is to put a scrollbar in for the sake of just one select option. All they "know" is that they can display up to 11 items at once.

keyplyr

7:24 pm on Jul 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You could always use a custom JavaScript drop down menu and have it look exactly like you want.