复制代码 代码如下:
<script language="javascript">

    /* 列表框互相操作函数集 */

  //描述: 添加不重复列表框元素
  function selAdd( srcList, dstList )
  {
      var selectedIndex = new Array();
      var count = 0;

      for ( i=0; i<srcList.options.length; i++ ){

         if ( srcList.options[i].selected ){

             selectedIndex[count] = i;
             count ++;

         }
     }                   

     for ( j=0; j<selectedIndex.length; j++ ){

         k = selectedIndex[j];

         if ( chkDup( srcList.options[k].value, dstList )==false ){
       &, nbsp;   dstList.options.length++;
             var len = dstList.options.length-1;
             dstList.options[len].value = srcList.options[k].value;
             dstList.options[len].text = srcList.options[k].text;
         }

     }

 }

 //描述: 删除列表框元素
 function selDel( list )
 {
     var len = list.options.length;
     var idx = 0;

     while ( idx< len ){

         if ( list.options[idx].selected ){
             list.options.remove(idx);
             len = list.options.length;
         }
         else{
             idx ++;
         }
     }
 }

 //描述: 检测列表框元素重复
 function chkDup( item, list )
 {
     for ( i=0; i<list.options.length; i++ ){
         //alert( item + " - " + list.options[i].value );
         if ( item == list.options[i].value ){
             return true;
         }
     }                   
     return false;
 }

 //描述: 选择列表框的全部成员
 function selSel( list, item )
 {
     item.value = " ";
     for ( i=0; i<list.options.length; i++ ){
         list.options[i].selected=true;
         item.value += list.options[i].value + " ";
     }

 }

 function selSelSingle( list, value )
 {
     for ( i=0; i<list.options.length; i++ ){
         if ( list.options[i].value == value ){
             list.options[i].selected=true;
             break;
         }
     }

 }
 //描述: 根据数组初始化列表框
 function selList( item, arr )
 {

     var curIndex, insIndex, val, text;
     var arrItem = new Array();

     if ( item ){

         item.length = 0;
         curIndex = 0;

        for ( i=0; i<arr.length; i++ ){

             item.length ++;
            insIndex = item.length - 1;

            if ( arr[i] ){
                arrItem = arr[i].split( ", " );
                text = arrItem[1];
                val  = arrItem[0];
                item.options[ insIndex ].text = text;   
                item.options[ insIndex ].value= val;
            }
        }

    }
}

    </script>
标签:
javascript,函数

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“javascript列表框操作函数集合汇总”

暂无“javascript列表框操作函数集合汇总”评论...

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。