showing scroll bars in drop-down list

L

Loane Sharp

Hi there,
I have several drop-down boxes in my form, and when I click on the drop-down
box to reveal the options, sometimes the list of options opens upward (above
the box) and sometimes downward (below the box), depending on the number of
options in each drop-down. Apparently there is a default mechanism at work
that displays the options in a visible part of the screen.

This looks very messy ... some boxes open up, some down, some in the middle
.... so within JavaScript I use the following ~

form1.select1.options.length = "8";

~ to limit the number of options displayed in a particular list to 18.

However I lose the scroll bars in the drop-down list when I do this.

Is there an alternative way to do this, or is there a way to show the scroll
bars?

Cheers
Loane
 
S

Steve Pugh

I have several drop-down boxes in my form, and when I click on the
drop-down box to reveal the options, sometimes the list of options
opens upward (above the box) and sometimes downward (below the box),
depending on the number of options in each drop-down. Apparently there
is a default mechanism at work that displays the options in a visible
part of the screen.

That's the standard operating system display. It's to prevent the drop
down from vanishing off the edge of the window.
This looks very messy ... some boxes open up, some down, some in the
middle

It's what the users are used to. Changing it can be risky as users may
become disorientated when what looks like a standard form element starts
behaving in a non-standard way.
... so within JavaScript I use the following ~

form1.select1.options.length = "8";

~ to limit the number of options displayed in a particular list to 18.

8 or 18? I presume 8, as 18 would still display scrollbars on Windows.
However I lose the scroll bars in the drop-down list when I do this.

No you don't. You lose all the options in the drop down after the 8th one.

If you changed your JS to this:
form1.select1.options.length = "8";
form1.select1.options.length = "20";
you would then see that all the options after the 8th are blank. You
deleted them with the first line of code and the second line of code
merely inserted blank options.

So the reason there are no scrollbars is because they're not needed -
there are no more options to be seen.
Is there an alternative way to do this, or is there a way to show the
scroll bars?

Stop worrying about trying to change default OS behaviours.

Steve
 
L

Loane Sharp

Hi Steve

So can it be done?


Steve Pugh said:
That's the standard operating system display. It's to prevent the drop
down from vanishing off the edge of the window.


It's what the users are used to. Changing it can be risky as users may
become disorientated when what looks like a standard form element starts
behaving in a non-standard way.


8 or 18? I presume 8, as 18 would still display scrollbars on Windows.


No you don't. You lose all the options in the drop down after the 8th one.

If you changed your JS to this:
form1.select1.options.length = "8";
form1.select1.options.length = "20";
you would then see that all the options after the 8th are blank. You
deleted them with the first line of code and the second line of code
merely inserted blank options.

So the reason there are no scrollbars is because they're not needed -
there are no more options to be seen.


Stop worrying about trying to change default OS behaviours.

Steve
 
S

Steve Pugh

So can it be done?

Can what be done? Can you force a drop down to always go down even if
that means it goes off the edge of the screen? No.

And please do not top post.

Steve
 
L

Loane Sharp

Hi Steve

That's pretty much what I'm trying to prevent. I'll let you know what I find
 
S

Steve Pugh

That's pretty much what I'm trying to prevent. I'll let you know what I find

Huh? You're trying to prevent something that the operating system
already prevents automatically? So doing nothing will do exactly what
you want?

Or do you have a page that shows us a drop down going off the edge of
the screen? URL please?

Did you not understand this?
http://www.html-faq.com/etiquette/?toppost

Steve
 
B

brucie

In alt.html Steve Pugh said:
Huh? You're trying to prevent something that the operating system
already prevents automatically?

an early .9 mozilla had a bug with the drop downs dropping up and going
off screen. i remember because i though it was funny and it made me
giggle.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top