select box without scrollbar
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

select box without scrollbar

From: rajesh <jayaram@yahoo.co.in>
Date: Fri Jan 20 2006 - 14:13:56 CET

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[i].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[i].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 ***
Received on Tue Feb 7 21:15:23 2006