Regarding Listbox height

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • onlymukti4u
    New Member
    • Mar 2007
    • 50

    #1

    Regarding Listbox height

    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
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Use the size attribute:
    [html]<select ... size="10">[/html]

    Comment

    • onlymukti4u
      New Member
      • Mar 2007
      • 50

      #3
      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
      Last edited by acoder; Jun 25 '08, 01:40 PM. Reason: Added [code] tags

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        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

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          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.

          Comment

          • onlymukti4u
            New Member
            • Mar 2007
            • 50

            #6
            Thanks for your response. I think I have to make a customized listbox. Anyway thanks.

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              If you have any questions and need help implementing it, ask in the JavaScript forum.

              Comment

              Working...