用js方法遍历listbox的项怎么写?
怎么把这个方法在js中实现。foreach(ListItemiteminltbUnfiled.Items){if(item.Selected){if(ltbInthis....
怎么把这个方法在js中实现。
foreach (ListItem item in ltbUnfiled.Items)
{
if (item.Selected)
{
if (ltbInthis.Items.FindByValue(item.Value) == null)
ltbInthis.Items.Add(item);
}
}
for (int i = 0; i < ltbUnfiled.Items.Count; i++)
{
if (ltbUnfiled.Items[i] != null && ltbUnfiled.Items[i].Selected)
{
ltbUnfiled.Items.RemoveAt(i);
i--;
}
} 展开
foreach (ListItem item in ltbUnfiled.Items)
{
if (item.Selected)
{
if (ltbInthis.Items.FindByValue(item.Value) == null)
ltbInthis.Items.Add(item);
}
}
for (int i = 0; i < ltbUnfiled.Items.Count; i++)
{
if (ltbUnfiled.Items[i] != null && ltbUnfiled.Items[i].Selected)
{
ltbUnfiled.Items.RemoveAt(i);
i--;
}
} 展开
1个回答
展开全部
<script language="javascript" type="text/javascript">
function GetList() {
var lstStaffs = document.getElementById("lstStaffs");
var strStaffs = "";
for (var i = 0; i < lstStaffs.options.length; i++) {
strStaffs += "第" + (i + 1) + "个是" + lstStaffs.options[i].value + "<br />";
}
document.getElementById("divStaffs").innerHTML = strStaffs;
}
</script>
function GetList() {
var lstStaffs = document.getElementById("lstStaffs");
var strStaffs = "";
for (var i = 0; i < lstStaffs.options.length; i++) {
strStaffs += "第" + (i + 1) + "个是" + lstStaffs.options[i].value + "<br />";
}
document.getElementById("divStaffs").innerHTML = strStaffs;
}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询