怎么在JS中删除dropdownlist中的所有项? for(var k = 0; k < ddl_Marster.options.length; k++) { ddl.remove(k); }这样好象不行~~~~ 好象会留一项 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function __doRemoveAllItem(select) { if (select.options.length>0) { if (confirm('是否确定要清空所有?')) { var i = 0, c1 = select.options.length; for( i=0; i<c1; i++) { __doRemoveSelectedItem(select, i); i--; c1--; } } } } function __doRemoveSelectedItem(select, index) { var idx = index; if( idx == null) { idx = select.selectedIndex; } if( idx < 0 ) { alert('请先选定要操作的选项!'); return; } while( idx >= 0 ) { select.options[idx] = null; idx = select.selectedIndex; } }======================================<INPUT class="btnreturn" style="WIDTH: 28px" onclick="__doRemoveAllItem(ListBoxRight); return false;" type="button" value="<<"> i gonna kown ,it's easy thx function optionsClear(e) { for (var i=e.options.length; i>0; i--) e.remove(i); } document.getElementById("ddl_Marster").innerHTML="" net_lover(【孟子E章】高手 asp:repeater里怎么根据数据库字段值判断? 怎么自己做visual studio中的控件? 用masterpage导航栏如何达到那种效果? 很简单的问题 一个关于iis的问题 pop3是邮政代理版本号3的缩写吗? [下载]学习.Net的电子图书 菜问-代码什么意思 菜鸟问题:如何用 ASP.net 与 JavaScript 实现图片上传 ? (高分100)用ASP.NET实现主菜单的制作 在asp.net2.0中如何定义数据集为Session变量 请教关于DATAGRID的模板列中CHECKBOX控件的问题
{
if (select.options.length>0)
{
if (confirm('是否确定要清空所有?'))
{
var i = 0, c1 = select.options.length;
for( i=0; i<c1; i++)
{
__doRemoveSelectedItem(select, i);
i--;
c1--;
}
}
}
}
function __doRemoveSelectedItem(select, index)
{
var idx = index;
if( idx == null)
{
idx = select.selectedIndex;
}
if( idx < 0 )
{
alert('请先选定要操作的选项!');
return;
}
while( idx >= 0 )
{
select.options[idx] = null;
idx = select.selectedIndex;
} }
======================================<INPUT class="btnreturn" style="WIDTH: 28px" onclick="__doRemoveAllItem(ListBoxRight); return false;"
type="button" value="<<">
{
for (var i=e.options.length; i>0; i--)
e.remove(i);
}
高手