javascript对ListBox的增或者是删
假设有个ListBoxID分别为lbLeftlbRight
选中lbLeft里的项添加到lbRight里:
function add()
{
var left;
var right;
left = documentgetElementById(lbLeft);
right = documentgetElementById(lbRight);
for(var i=;i<leftlength;i++)
{
if(leftoptions[i]selected)
{
//判断该项是否已经存在
for(j=;j<rightlength;j++)
{
if(rightoptions[j]value==leftoptions[i]value)
{
return;
}
}
rightadd(new Option(leftoptions[i]textleftoptions[i]value));
}
}
}
[] []