This Domain(Admin5.com) is for Sale:

用Javascript 实现的Dual listbox

时间:2007-12-27  来源:不详  作者:林子
file://目标:只有“无”项目,则先删除该提示性项目
sel_dest.options.remove(0);

dedecms.com


var SelectedText = sel_source.options[sel_source.selectedIndex].text;
sel_dest.options.add(new Option(SelectedText));
sel_source.options.remove(sel_source.selectedIndex);

copyright dedecms

if (sel_source.options.length==0) file://源:假如删除完所有有用项目,则添加提示项目:“无”
sel_source.options.add(new Option("无"));
}

copyright dedecms

function MoveAllItems(sel_source, sel_dest)
{
if (sel_source.options[0].text=="无") file://源:只有“无”项目
return; 内容来自dedecms

if (sel_dest.options[0].text=="无") file://目标:只有“无”项目,则先删除该提示性项目
sel_dest.options.remove(0);

织梦内容管理系统

file://首先拷贝所有项目到目标:
var sel_source_len = sel_source.length;
for (var j=0; j<sel_source_len; j )
{
var SelectedText = sel_source.options[j].text;
sel_dest.options.add(new Option(SelectedText));
}

dedecms.com


file://然后删除“源”所有项目:
while ((k=sel_source.length-1)>=0)
{
if (sel_source.options[0].text=="无") file://源:只有“无”项目
break;
sel_source.options.remove(k);
if (sel_source.options.length==0) file://源:假如删除完所有有用项目,则添加提示项目:“无”
sel_source.options.add(new Option("无"));
}
}

本文来自织梦

function SelectAll(theSel) file://选中select中全部项目
{ for (i = 0 ;i<theSel.length;i )
theSel.options[i].selected = true;
}
</script> 内容来自dedecms

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息