日期:2009-06-25  浏览次数:21050 次

具体功能用一下就知道了,在下拉框中选择一个,左边的列表框就显示相应的值,点那4个按钮能够实现左右2个列表框选项互相排斥,很好玩的。。估计大家开发的时候经常要用到,所以就帖上来了。

代码如下:
<style>
td,select,input{font-size:9pt}
</style>
<script>
var subcat = new Array();                                      //  下拉列表数组定义
    subcat[0] = new Array("计划采购员B","2","cs101");
    subcat[1] = new Array("仓库管理员B","2","cs111");
    subcat[2] = new Array("仓库管理员","1","111");
    subcat[3] = new Array("门市管理员","1","122");
    subcat[4] = new Array("计划审批员","1","MASTER");
    subcat[5] = new Array("计划审批员B","2","cs100");
    subcat[6] = new Array("计划采购员","1","103");
    subcat[7] = new Array("统计员","1","李尚英");
    subcat[8] = new Array("统计员B","2","cs133");
                                                        //   这个数组可以根据实际需要用程序继续添加元素
var onecount=subcat.length;
var c=0;d=0;                                            //     2个select的optoins的索引位置...

function moveto2(fn,s1,s2)                                //     ">>" Button function
{
    fs1=eval(fn+"."+s1);                                //      formName1.SelectName1
    fs2=eval(fn+"."+s2);
    d=fs2.options.length;
    for(i=0;i<fs1.options.length;i++)
        {
            var myOption = new

            Option(fs1.options[i].innerText,fs1.options[i].value);  

            fs2.options[d]=myOption ;
            fs2.options[d].selected=true;
            fs1.options[i].selected=true;
            d++;
        }
    k=0;
    while(k<fs1