select box without scrollbar

Discussion in 'Javascript' started by rajesh, Jan 20, 2006.

  1. rajesh

    rajesh Guest

    Is it possible to display the select box without scrollbar
    in my program there is a need for that . The code attached below
    contains 2 select box and four buttons and the button is used to
    interchange the data's in the select box.
    (provuide coding for no scrollbar in select box)

    Thank You in advance



    <htm>
    <body>
    <form name="listselection">
    <center>
    <br><br><br><br>

    <TABLE BORDER=0>
    <TR>


    <TD>
    <SELECT NAME="list1" id="list1" SIZE=20 style="width:100px;">
    <OPTION VALUE="Finance">Finance</OPTION>
    <OPTION VALUE="Marketing">Marketing</OPTION>
    <OPTION VALUE="Sales & Rep">Sales & Rep</OPTION>
    <OPTION VALUE="Shipping">Shipping</OPTION>
    <OPTION VALUE="Revenue">Revenue</OPTION>
    <OPTION VALUE="Transport">Transport</OPTION>
    </SELECT>
    </TD>

    <TD VALIGN=MIDDLE ALIGN=CENTER>
    <INPUT TYPE="button" NAME="right" VALUE=">"
    ONCLICK="moverightsingle()"><BR><BR>
    <INPUT TYPE="button" NAME="right" VALUE="All >>"
    ONCLICK="moverightall()"><BR><BR>
    <INPUT TYPE="button" NAME="left" VALUE="<"
    ONCLICK="moveleftsingle()"><BR><BR>
    <INPUT TYPE="button" NAME="left" VALUE="All <<"
    ONCLICK="moveleftall()">
    </TD>


    <TD>
    <SELECT NAME="list2" id="list2" MULTIPLE SIZE=20 style="width:100px;">
    <OPTION VALUE="One">One</OPTION>
    <OPTION VALUE="Two">Two</OPTION>
    <OPTION VALUE="Three">Three</OPTION>
    <OPTION VALUE="Four">Four</OPTION>
    <OPTION VALUE="Five">Five</OPTION>
    <OPTION VALUE="Six">Six</OPTION>

    </SELECT>
    </TD>

    </TR>

    </TABLE>
    </center>
    <form>
    </body>
    </html>

    <script>

    function moverightsingle()
    {

    var x=document.getElementById("list1")
    var y=x.options[x.selectedIndex].text
    var index=x.selectedIndex;

    myOption=new Option();
    myOption.text=y;

    insertIndex=document.listselection.list2.options.length;
    document.listselection.list2.options[insertIndex]=myOption;
    document.listselection.list1.options[index]=null;
    }

    function moveleftsingle()
    {

    var xx=document.getElementById("list2");
    var yy=xx.options[xx.selectedIndex].text
    var index=xx.selectedIndex

    myOption=new Option();
    myOption.text=yy;

    insertIndex=document.listselection.list1.options.length;
    document.listselection.list1.options[insertIndex]=myOption;
    document.listselection.list2.options[index]=null;

    }

    function moverightall()
    {
    var listlength=document.getElementById("list1").length;

    for(var i=0;i<listlength;i++)
    {

    var x=document.getElementById("list1");
    var data=x.options.text

    myOption=new Option();
    myOption.text=data;

    insertIndex=document.listselection.list2.options.length;
    document.listselection.list2.options[insertIndex]=myOption;

    }

    for(var i=0;i<listlength;i++)
    {

    var x=document.getElementById("list1")
    var y=x.options[0].text
    var index=0;
    document.listselection.list1.options[index]=null;

    }

    }


    function moveleftall()
    {
    var listlength=document.getElementById("list2").length;

    for(var i=0;i<listlength;i++)
    {

    var x=document.getElementById("list2");
    var data=x.options.text

    myOption=new Option();
    myOption.text=data;

    insertIndex=document.listselection.list1.options.length;
    document.listselection.list1.options[insertIndex]=myOption;

    }

    for(var i=0;i<listlength;i++)
    {

    var x=document.getElementById("list2")
    var y=x.options[0].text
    var index=0;
    document.listselection.list2.options[index]=null;

    }

    }


    </script>


    *** Sent via Developersdex http://www.developersdex.com ***
     
    rajesh, Jan 20, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henri
    Replies:
    1
    Views:
    3,993
    brucie
    Aug 4, 2004
  2. Gnarlodious
    Replies:
    4
    Views:
    17,679
    elizas
    May 5, 2010
  3. Alex

    ScrollBar? Does it exist just WEB ScrollBar Control?

    Alex, Apr 1, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    292
    Alvin Bruney [MVP]
    Apr 4, 2004
  4. palmiere
    Replies:
    1
    Views:
    451
    Erwin Moller
    Feb 9, 2004
  5. rajesh
    Replies:
    1
    Views:
    259
    Evertjan.
    Jan 21, 2006
Loading...

Share This Page