我有以下代码:
function removeUsers()
{
var removedUsers = document.getElementById('<%=removedUsers.ClientID%>');
var lbCurrent = document.getElementById('<%=lbCurrent.ClientID%>');
if (lbCurrent && lbCurrent.selectedIndex != -1)
{
for(i=lbCurrent.length-1; i>=0; i--)
{
if(lbCurrent.options[i].selected)
{
//add the removed user to the removedUsers var
removedUsers.value += lbCurrent.options(i).value + ";";
lbCurrent.options[i] = null;
}
}
}
selectAllItems();
}
这导致我在Firefox中的问题:
removedUsers.value += lbCurrent.options(i).value + ";";
有人可以帮忙吗?
谢谢
最佳答案
removedUsers.value += lbCurrent.options(i).value + ";";
应该
removedUsers.value += lbCurrent.options[i].value + ";";
假设
lbCurrent.options
是Array
。