select box without scrollbar

R

rajesh

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top