<script language="javascript">
function add_singer(object,value,text)//添加
{
if(singer_exist(object,value)==false)
{
object.options.add(new Option(text,value,true,true));
object.selectedIndex=0;
return true;
}
return false;
} function remove_singer(object,index)//删除
{
if(index==0)
return false;
object.options.remove(index)
object.selectedIndex=0;
}
function insert_singer(object,value,text,index)//插入
{
if(singer_exist(object,value)==false)
{
if(index>0)
{
newoption=document.createElement('option');
newoption.value=value;
newoption.text=text;
object.options.add(newoption,index);
}
else
{
object.options.add(new Option(text,value,true,true));
}
object.selectedIndex=0;
return true;
}
return false;
}
function singer_exist(object,value)//判断是否已经存在
{
for(var i=0;i<object.options.length; i++)
{
if(object.options[i].value==value)
return true;
}
return false;
}
</script>给你个操作下拉列表的函数,就当参靠吧
function add_singer(object,value,text)//添加
{
if(singer_exist(object,value)==false)
{
object.options.add(new Option(text,value,true,true));
object.selectedIndex=0;
return true;
}
return false;
} function remove_singer(object,index)//删除
{
if(index==0)
return false;
object.options.remove(index)
object.selectedIndex=0;
}
function insert_singer(object,value,text,index)//插入
{
if(singer_exist(object,value)==false)
{
if(index>0)
{
newoption=document.createElement('option');
newoption.value=value;
newoption.text=text;
object.options.add(newoption,index);
}
else
{
object.options.add(new Option(text,value,true,true));
}
object.selectedIndex=0;
return true;
}
return false;
}
function singer_exist(object,value)//判断是否已经存在
{
for(var i=0;i<object.options.length; i++)
{
if(object.options[i].value==value)
return true;
}
return false;
}
</script>给你个操作下拉列表的函数,就当参靠吧
解决方案 »
- 求解:如何给easyui datagird的表头以及各个数据单元格添加onmouseover以及onmouseout事件?
- js传递数组作为参数的问题?
- 50分。如题,我有一个jsp页面,里面有一个iframe,如何做到加载iframe中的页面后刷新父页面,而不刷新该iframe页面?
- js 字符串 查出a-z的汉字和字母
- javascript调用 Activex控件问题
- 有关变色的奇怪的问题
- IE5和IE6的问题
- window.print 如何知道是选择了打印还是取消
- highchart数据绑定
- 把一张图设置为背景,然后分成四个位置,怎么才能实现点击不同的位置实现不同的跳转?
- javascript解析xml几个简单问题 急!在线,解决给分。
- 100分急求一个小东西的源码 赶紧来挣分!!!
是否这种...
你EMAIL是多少我把代码给你
网上查查资料,一大堆
<tr><td>
<select id=list1 size=8 ondblclick="moveOption(this, this.form.list2)">
<option value=A>aaaaaaaaaa
<option value=B>bbbbbbbbbb
<option value=C>cccccccccc
<option value=D>dddddddddd
<option value=E>eeeeeeeeee
<option value=F>ffffffffff
<option value=G>gggggggggg
<option value=H>hhhhhhhhhh
</select></td>
<td width=40 align=center>
<input name=add type=button value=">>>" onclick="moveOption(this.form.list1, this.form.list2)"><br><br>
<input name=sub type=button value="<<<" onclick="moveOption(this.form.list2, this.form.list1)">
</td><td>
<select id=list2 size=8 ondblclick="moveOption(this, this.form.list1)">
</select>
</td></tr></form>
</table><script language="JavaScript"><!--
function moveOption(e1, e2){
try{
var e = e1.options[e1.selectedIndex];
e2.options.add(new Option(e.text, e.value));
e1.options.remove(e1.selectedIndex);
} catch(e){}
}
//--></script>