快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

列表框操作函数集合

//描述: 添加不重复列表框元素
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;
}
}

}
}
返回类别: 教程
上一教程: 比较方便的ASP分页程序
下一教程: 将指定的ASP文件内容生成HTML文件

您可以阅读与"列表框操作函数集合"相关的教程:
· 一个比较使用的ASP 函数集合类
· 一个比较实用的ASP函数集合类
· 在ASP中用集合成批操作数据库
· 在ASP中用集合成批操作数据库
· ASP函数集
    微笑服务 优质保证 索取样品