怎么用JavaScript获取DropDownList选中得值,再添加到ListBox中 怎么用JavaScript获取DropDownList选中得值,再添加到ListBox中。怎么用JavaScript删除ListBox选中得值!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ListBox生成之后也是一个SelectDropDownList也是一个Select操作它们的options就可以了 var select1 = document.all.<%= yourDropDownList.ClientID %>;var select1value = select1.options[select1.selectedIndex].value;var select1Text = select1.options[select1.selectedIndex].innerText;var select2 = document.all.<%= yourListBox.ClientID %>;var oOption = document.createElement("OPTION");select2.options.add(oOption);oOption.innerText = select1Text oOption.Value = select1value ; select2.options.remove(select2.selectedIndex) select2.options.remove(select2.selectedIndex) function test(){ var drp = document.getElementById("DropDownList1"); var lst = document.getElementById("ListBox1"); if (drp.length > 0) { for (i=0; i < drp.options.length; i++) { if (drp.options(i).selected == true) { var oOption = document.createElement("OPTION"); lst.options.add(oOption); oOption.innerText = drp.options(i).innerText; oOption.value = drp.options(i).value; } } }}function test1(){ var lst = document.getElementById("ListBox1"); if (lst.length > 0) { for (i=0; i < lst.options.length; i++) { if (lst.options(i).selected == true) { lst.options.remove(i); } } }} 请问现在开发一个小型论坛需要学习哪些技术 ASP.NET中的问题 关于vs2005的简单问题 (调查)目前做asp.net高级程序员 比备技能有那些.... 页面上多个输入框,多个验正控件,多个提交按钮,怎样做到不互相干扰? 关于三楼楼长提供的OA系统的权限设计 动态给用户赋予角色信息 菜鸟DataGrid删除是出现的问题? 简单拿分问题 怎么做这样的东西? 奇怪的错误~~~~ 一页只能有一个服务器端 Form 标记。在线等~~~~~~~~~~~~~ 配置错误,但webmatrix下正常
DropDownList也是一个Select
操作它们的options就可以了
var select1value = select1.options[select1.selectedIndex].value;
var select1Text = select1.options[select1.selectedIndex].innerText;
var select2 = document.all.<%= yourListBox.ClientID %>;
var oOption = document.createElement("OPTION");
select2.options.add(oOption);
oOption.innerText = select1Text
oOption.Value = select1value ;
{
var drp = document.getElementById("DropDownList1");
var lst = document.getElementById("ListBox1");
if (drp.length > 0)
{
for (i=0; i < drp.options.length; i++)
{
if (drp.options(i).selected == true)
{
var oOption = document.createElement("OPTION");
lst.options.add(oOption);
oOption.innerText = drp.options(i).innerText;
oOption.value = drp.options(i).value;
}
}
}
}function test1()
{
var lst = document.getElementById("ListBox1");
if (lst.length > 0)
{
for (i=0; i < lst.options.length; i++)
{
if (lst.options(i).selected == true)
{
lst.options.remove(i);
}
}
}
}