一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

列表框操作函数集合

时间:2008-01-18 编辑:简简单单 来源:一聚教程网

/* 列表框互相操作函数集 */
//描述: 添加不重复列表框元素
function selAdd( srcList, dstList )
{
    var selectedIndex = new Array();
    var count = 0;
    for ( i=0; i        if ( srcList.options[i].selected ){
       
       selectedIndex[count] = i;
       count ++;
        }
    }          
    for ( j=0; j        
        k = selectedIndex[j];
        if ( chkDup( srcList.options[k].value, dstList )==false ){
       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{

热门栏目