/* 列表框互相操作函数集 */
//描述: 添加不重复列表框元素
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;
}
}
}
}
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器