这意思??<html>
<head>
<title>Select Op</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<script type="text/javascript">
var o;
function MoveTo(index)
{
if (index!=undefined)
{
o=source.options[index];
distinct.options.add(new Option(o.text,o.value));
source.options.remove(index);
}
else
{
for(var i=0;i<source.options.length;)//不要在这里控制i的增长,因为有可能删除了option
{
if(source.options[i].selected)
{
o=source.options[i];
distinct.options.add(new Option(o.text,o.value));
source.options.remove(i);
i=0;
}
else
i++;
}
}
}
function MoveBack(index)
{
if (index!=undefined)
{
o=distinct.options[index];
source.options.add(new Option(o.text,o.value));
distinct.options.remove(index);
}
else
{
for(var i=0;i<distinct.options.length;)//不要在这里控制i的增长,因为有可能删除了option
{
if(distinct.options[i].selected)
{
o=distinct.options[i];
source.options.add(new Option(o.text,o.value));
distinct.options.remove(i);
i=0;
}
else
i++;
}
}
}
</script>
</head>
<body>
<table width='500' border='1' cellpadding='0' cellspacing='0'>
<tr>
<td width='45%' align="center"><select id='source' multiple="multiple" style="width:200; height:300" ondblclick="MoveTo(this.selectedIndex)">
<option value='1'>Item1</option>
<option value='2'>Item2</option>
<option value='3'>Item3</option>
<option value='4'>Item4</option>
<option value='5'>Item5</option>
<option value='6'>Item6</option>
</select></td>
<td width='10%' align="center"><input type="button" value=">>" onclick="MoveTo()" /><br /><input type="button" value="<<" onclick="MoveBack()" /></td>
<td width='45%'><select id='distinct' ondblclick="MoveBack(this.selectedIndex)" style="width:200; height:300" multiple="multiple" align="center"></select></td>
</tr>
</table>
</body>
</html>
<head>
<title>Select Op</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<script type="text/javascript">
var o;
function MoveTo(index)
{
if (index!=undefined)
{
o=source.options[index];
distinct.options.add(new Option(o.text,o.value));
source.options.remove(index);
}
else
{
for(var i=0;i<source.options.length;)//不要在这里控制i的增长,因为有可能删除了option
{
if(source.options[i].selected)
{
o=source.options[i];
distinct.options.add(new Option(o.text,o.value));
source.options.remove(i);
i=0;
}
else
i++;
}
}
}
function MoveBack(index)
{
if (index!=undefined)
{
o=distinct.options[index];
source.options.add(new Option(o.text,o.value));
distinct.options.remove(index);
}
else
{
for(var i=0;i<distinct.options.length;)//不要在这里控制i的增长,因为有可能删除了option
{
if(distinct.options[i].selected)
{
o=distinct.options[i];
source.options.add(new Option(o.text,o.value));
distinct.options.remove(i);
i=0;
}
else
i++;
}
}
}
</script>
</head>
<body>
<table width='500' border='1' cellpadding='0' cellspacing='0'>
<tr>
<td width='45%' align="center"><select id='source' multiple="multiple" style="width:200; height:300" ondblclick="MoveTo(this.selectedIndex)">
<option value='1'>Item1</option>
<option value='2'>Item2</option>
<option value='3'>Item3</option>
<option value='4'>Item4</option>
<option value='5'>Item5</option>
<option value='6'>Item6</option>
</select></td>
<td width='10%' align="center"><input type="button" value=">>" onclick="MoveTo()" /><br /><input type="button" value="<<" onclick="MoveBack()" /></td>
<td width='45%'><select id='distinct' ondblclick="MoveBack(this.selectedIndex)" style="width:200; height:300" multiple="multiple" align="center"></select></td>
</tr>
</table>
</body>
</html>
解决方案 »
- 关于jqgrid使用json赋值的问题
- js中这个写法代表什么?
- 哪位大侠能帮我修改一下代码(鼠标经过div DIV由透明变为不透明),小弟不胜感激
- 请解释一下 滚动效果的原理。
- 求救:jQuery如何处理select事件?
- IE10升级有什么比较好的兼容IE8版本为基础开发的前台代码的策略么?
- 框架问题
- 关于取table里的值的问题,急,在线等,解决就结贴,谢谢
- 点击一个连接,出现一个提示,点是就到另外一个页面,点否就不动,
- (……)我想在表单提交前用JS验证数据,当不通过时就不提交,可是不通过她也自动提交,请问怎么做!(程序在内)
- Ext的panel里的数据不能提交 急!!!
- 请问使用有一组TextBox,(最多显示5组,最少一组),想通过“增加”,“删除”按钮来添加,减少一组TextBox,请问大家如何使用javascript实现?
oSrc.ondblclick = function() {
var oOption = document.createElement("OPTION");
oOption.text = oSrc.options[oSrc.selectedIndex].text;
oOption.value = oSrc.options[oSrc.selectedIndex].value;
oTarget.options.add(oOption);
}
oTarget.ondblclick = function() {
oTarget.removeChild(oTarget.options[oTarget.selectedIndex]);
}
<html>
<head>
<title>Example</title>
</head>
<body>
<select name="select1" size="10" id="select1" onDblclick="dataChange(this,this.options[this.selectedIndex].innerText,this.value)">
<option value="a" selected>A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
<option value="e">E</option>
</select>
<select name="select2" size="10" id="select2" onDblclick="dataChange(this,this.options[this.selectedIndex].innerText,this.value)">
</select>
</body>
<script type="text/javascript">
function dataChange(obj,text,value){
var anotherobj;
if(obj.id=="select1"){
anotherobj = document.getElementById("select2");
} else{
anotherobj = document.getElementById("select1");
}
anotherobj.options.add(new Option(text,value));
obj.removeChild(obj.options[obj.selectedIndex]);
}
</script>
</html>
<head>
<title>Example</title>
</head>
<body>
<select name="select1" size="10" id="select1" onDblclick="dataChange(this)">
<option value="a" selected>A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
<option value="e">E</option>
</select>
<select name="select2" size="10" id="select2" onDblclick="dataChange(this)">
</select>
</body>
<script type="text/javascript">
function dataChange(obj){
var text = obj.options[obj.selectedIndex].innerText;
var value = obj.value;
var anotherobj;
if(obj.id=="select1"){
anotherobj = document.getElementById("select2");
} else{
anotherobj = document.getElementById("select1");
}
anotherobj.options.add(new Option(text,value));
obj.removeChild(obj.options[obj.selectedIndex]);
}
</script>