forms selct box

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

forms selct box

Post by FireElement »

My google skills are getting worse I think?

Anyways I just wondered if there was away to change the length of a select box.
Say if I had 100 options how would i make only 10 show in the drop down box.

That way the select box would be more user friendly! Is it possible?
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

I dont mean size either!

I mean the actual bit that drops down!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There is little actual control over that as it is drawn primarily by the host operating system with most browsers.

The only control we can (in some cases) exert over it is by setting the height value of the options, but be careful as the host system may not check those values and draw the box too large or off-screen.

This is a client-side question.
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

so basically not unless you use javescript? If its really complex then am not the bothered really just thought it was not listed because it was obvious.

Reminds me of the prime number formula.... there isnt one but you think there would be! i been close a few times but in the end the only patern I see is that all prime numbers after the first few of course all end in 1 3 7 or 9 also that any new prime numbers that accure knock out any what would seem like a prime number. Bascailly in other words you get 13 it will take out 39 it looks like prime but is not because 13 took it out. In other words prime numbers pattern is not possible because a previous prime number makes it random so you have to check every number that look like a prime with all prime numbers below half it self. eg all primes belwo 19.5 in 39 case to check its not a prime.

I dont really know why I said that guess I was just bored and decided I would have ago at breaking it again....

Anyways I may look in to javascript on it. To be honest I was not that fussed.
devendra-m
Forum Contributor
Posts: 111
Joined: Wed Sep 12, 2007 3:16 am

Post by devendra-m »

refer http://www.hotandco.com/

select netherlands in the country field then you will get city field filled with cities. In that city field you can either type or select directly
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Normally when I have a problem like this I start to look at w3schools.com but it doesn't seem to be working today. Aside from core HTML which doesn't do what you want surely the answer lies in where you are getting the information from in the first place. If it is PHP it is easy enough to only show the first ten, to randomise it or rank it. This would be better than a pure javascript solution.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

So you are looking for a select list that is long, or a select multiple list that only list the first 10 of the data set?
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

I was looking to just make a the drop down part of a select box only display ten items and a scroll if more then ten was in.

Just so it was neater.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Do that in PHP.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

FireElement wrote:I was looking to just make a the drop down part of a select box only display ten items and a scroll if more then ten was in.

Just so it was neater.
Not sure if you can control the number of items shown in a select box before causing a scroll. I think this is controlled by the browser, which also controls whether the box opens up or down depending on placement in the viewport at the time the box is activated.
Post Reply