By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,259 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,259 IT Pros & Developers. It's quick & easy.

Regarding Listbox height

P: 50
Hi ,

I just want to create a listbox, with 100 items in it, but it should not show all items at a time, there should be a vertical scroll in which I can see 10 items at a time and I can scroll this down to see the below items.

thanks in advance.

Regrads,
Prasad
Jun 24 '08 #1
Share this Question
Share on Google+
6 Replies


acoder
Expert Mod 15k+
P: 16,027
Use the size attribute:
[html]<select ... size="10">[/html]
Jun 24 '08 #2

P: 50
thanks for your quick response, but what I need is if I am setting an attribute size to 10 it is showing the elements of 10 in a box with scrollbar, but I want actually the listbox followed by the display box having scrolls.

example:
[HTML]<select name="" >
<option>mukti</option>
<option>sssss</option>
<option>ddddd</option>
<option>fffff</option>
<option>wwwww</option>
<option>vvvvv</option>
<option>bbbbb</option>
<option>mmmmm</option>
<option>nnnnn</option>
<option>mukti</option>
<option>sssss</option>
<option>ddddd</option>
<option>fffff</option>
<option>wwwww</option>
<option>vvvvv</option>
<option>bbbbb</option>
<option>mmmmm</option>
<option>nnnnn</option>
<option>mukti</option>
<option>sssss</option>
<option>ddddd</option>
<option>fffff</option>
<option>wwwww</option>
<option>vvvvv</option>
<option>bbbbb</option>
<option>mmmmm</option>
<option>nnnnn</option>
</select>
[/HTML]
if I am giving this on click of the down arrow it is showing all elements, but I need element of 10 and scrollbar. can u help me out.

Regards,
Prasad
Jun 25 '08 #3

gits
Expert Mod 5K+
P: 5,390
hmmm ... so you want to limit the 'popup-area' ... i think for this you have to create your own DHTML-dropdown-list ... similar to an ajax-auto-suggest-widget ...

kind regards
Jun 25 '08 #4

acoder
Expert Mod 15k+
P: 16,027
I'm afraid that's a browser default. In Firefox, it'll scroll after 20, I think, but in IE7, it just displays the whole thing. As gits said, you'll need to create your own DHTML version.

PS. please use code tags when posting code.
Jun 25 '08 #5

P: 50
Thanks for your response. I think I have to make a customized listbox. Anyway thanks.
Jun 26 '08 #6

acoder
Expert Mod 15k+
P: 16,027
If you have any questions and need help implementing it, ask in the JavaScript forum.
Jun 26 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.