大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> ASP专区 -> 列表框操作函数集合

列表框操作函数集合

时间: 2021-07-31 作者:daque

/* 列表框彼此操纵因变量集 *///刻画: 增添不反复列表框元素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 ){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;}}}}

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.