表框操作函数集合
来源:互联网 发布:网络大电影错爱 编辑:程序博客网 时间:2024/06/14 11:12
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;
}
}
}
}
{
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;
}
}
}
}
- 表框操作函数集合
- 列表框操作函数集合
- 列表框操作函数集合
- javascript列表框操作函数集合
- javascript列表框操作函数集合汇总
- Oracle集合操作函数
- C++字符串操作函数集合
- Kotlin集合及其操作函数
- day3_集合、文件操作、函数
- 链表操作集合
- oracle常用表操作:集合操作符以及简单函数的应用
- 有关时间操作的实用函数集合
- c++ stl集合操作函数若干
- PHP操作mysql数据库的函数集合
- C++ 字符串操作函数集合(部分)
- Oracle 集合操作函数:union、intersect、minus
- Oracle集合操作函数:union、intersect、minus
- ORACLE集合操作函数:UNION、INTERSECT、MINUS
- Ubuntu 7.04 乱码解决
- iptables入门
- 外贸企业网站的搜索引擎优化
- 我们一起奋斗
- ASP 页面 Provider 错误 '80004005' 未指定的错误 的最终解决方法
- 表框操作函数集合
- freeBSD挂载windows共享文件夹
- C++学习笔记(五)
- [转载] 設定 Visual C++ 2005 Express Edition 來編寫 Win32 程式
- 【转】JDBC解析
- 从SqlServer中随机读取记录
- Backdoor.Win32.IRCbot.vim(mdesvc.exe)
- 作者原序-引用oldjavaman的文章
- [LUPA学习向导]如何成为Shell编程高手