Two Vertical Scrollbars in select and DIC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aswinm
    New Member
    • Apr 2008
    • 1

    #1

    Two Vertical Scrollbars in select and DIC

    Hi All,

    I have a sample page in which I am enclosing a <Select within a DIV, The purpose is to have a horizontal scrollbar for the <Select. The page is working perfectly fine. But I notice that when the no of items in the <select is increasing many fold, the listbox is displaying its own scrollbar, even though the DIV is having space, resulting in two scrollbars. I am Unable to figure out why it is happening like this. If I reduce the font size, then the list is able to accomodate a few more entries. For ur reference I am attaching the code below.

    Please copy paste the options to more than 2000 items. The problem will come up.

    Thanx in Advance.
    [html]
    <html>
    <head><title> Testing select option</title>
    <script language="javas cript">
    function OnDivSrcScroll( )
    {
    if (SourceAccounts .options.length > 17)
    {
    SourceAccounts. size=SourceAcco unts.options.le ngth;
    }
    else
    {
    SourceAccounts. size=17;
    }
    }

    function OnSrcSelectFocu s()
    {

    if (document.getEl ementById("divS rcAccounts").sc rollLeft != 0)
    {
    document.getEle mentById("divSr cAccounts").scr ollLeft = 0;
    }

    }
    </script>
    </head>
    <body>

    <br><BR><HR>
    Please Choose
    <div id='divSrcAccou nts'
    style="overflow :auto;position: relative;width: 300px;HEIGHT: 233px;"
    onscroll="OnDiv SrcScroll();" >

    <SELECT size="17"
    name="SourceAcc ounts" multiple onfocus="OnSrcS electFocus();" >

    <OPTION value="00300010 9">003000109&nb sp;&nbsp;&nbsp; FCIA DEL PUEBLO</OPTION>

    <OPTION value="00300013 3">003000133&nb sp;&nbsp;&nbsp; FCIA DEL CARMEN *OROCOVIS*GNP*</OPTION>

    <OPTION value="00300015 8">003000158&nb sp;&nbsp;&nbsp; U-SAVE PHARMACY L.L.C. *GNP*</OPTION>

    <OPTION value="00300018 2">003000182&nb sp;&nbsp;&nbsp; FCIA NUEVA,JM PHA GRP INC*GNP*</OPTION>

    <OPTION value="00300010 9">003000109&nb sp;&nbsp;&nbsp; FCIA DEL PUEBLO</OPTION>

    <OPTION value="00300013 3">003000133&nb sp;&nbsp;&nbsp; FCIA DEL CARMEN *OROCOVIS*GNP*</OPTION>

    <OPTION value="00300015 8">003000158&nb sp;&nbsp;&nbsp; U-SAVE PHARMACY L.L.C. *GNP*</OPTION>

    <OPTION value="00300018 2">003000182&nb sp;&nbsp;&nbsp; FCIA NUEVA,JM PHA GRP INC*GNP*</OPTION>
    <OPTION value="00300010 9">003000109&nb sp;&nbsp;&nbsp; FCIA DEL PUEBLO</OPTION>

    <OPTION value="00300013 3">003000133&nb sp;&nbsp;&nbsp; FCIA DEL CARMEN *OROCOVIS*GNP*</OPTION>

    <OPTION value="00300015 8">003000158&nb sp;&nbsp;&nbsp; U-SAVE PHARMACY L.L.C. *GNP*</OPTION>

    <OPTION value="00300018 2">003000182&nb sp;&nbsp;&nbsp; FCIA NUEVA,JM PHA GRP INC*GNP*</OPTION>
    <OPTION value="00300010 9">003000109&nb sp;&nbsp;&nbsp; FCIA DEL PUEBLO</OPTION>

    <OPTION value="00300013 3">003000133&nb sp;&nbsp;&nbsp; FCIA DEL CARMEN *OROCOVIS*GNP*</OPTION>

    <OPTION value="00300015 8">003000158&nb sp;&nbsp;&nbsp; U-SAVE PHARMACY L.L.C. *GNP*</OPTION>

    <OPTION value="00300018 2">003000182&nb sp;&nbsp;&nbsp; FCIA NUEVA,JM PHA GRP INC*GNP*</OPTION>

    </SELECT>


    </div>
    </body>
    </html>[/html]
    Last edited by drhowarddrfine; Apr 2 '08, 03:42 PM. Reason: Please use code tags
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    [code=html]style=" height: 233px;
    width: 295px;
    overflow: scroll;"[/code]This style attribute in the code in the select (and eliminate the div) should do everything you want, but I checked in both FF and IE, and neither one worked. Sorry. Are you still looking for a solution?

    Jared

    Comment

    Working...