以这种样式来做 选中左边的复选框,点击“>”,移到右边;<移到左边。右边的条目,可通过move up ,down来上移或下移。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Page Selection</title><style>td{white-space:nowrap};body{margin-left:0;margin-right:0;margin-top=0;margin-bottom=0}; </style></head><body bgcolor=eeeeee><table><tr > <td> <select name=SrcSelect size=6 style="font-size:11pt;width=200;height=160px" multiple > <option value="1">test1</option> <option value="2">test2</option> <option value="3">test3</option> <option value="4">test4</option> <option value="5">test5</option> <option value="6">test6</option> </select> </td> <td align="center"> <input align="left" type=button value="→" onclick="moveLeftOrRight(document.all.SrcSelect,document.all.ObjSelect)" ><br><br> <input align="left" type=button value="←" onclick="moveLeftOrRight(document.all.ObjSelect,document.all.SrcSelect)" > </td> <td> <select name=ObjSelect size=6 style="font-size:11pt;width=200;height=160px" multiple > <option value="11">test11</option> <option value="12">test12</option> <option value="13">test13</option> <option value="14">test14</option> <option value="15">test15</option> <option value="16">test16</option> </select> </td> <td> <input type=button value="↑" onclick="moveUp()" ><br><br> <input type=button value="↓" onclick="moveDown()" > </td></tr> </table></body> <script language=javascript> function moveUp() { var theObj=document.all.ObjSelect;for(var i=1;i<theObj.length;i++) { if( theObj.options[i].selected && !theObj.options[i-1].selected ) { var tempOption=new Option(theObj.options[i-1].text,theObj.options[i-1].value); theObj.options[i-1].removeNode(true); theObj.add(tempOption,i); } }} function moveDown() { var theObj=document.all.ObjSelect;for(var i=theObj.length-2;i>-1;i--) { if( theObj.options[i].selected && !theObj.options[i+1].selected ) { var tempOption=new Option(theObj.options[i].text,theObj.options[i].value); theObj.options[i].removeNode(true); theObj.add(tempOption,i+1); theObj.options[i+1].selected=true; } }} function moveLeftOrRight(fromObj,toObj) { var lengthOfToObj=toObj.length; for(var i=fromObj.length-1;i>-1;i--) { if(fromObj.options[i].selected) { toObj.add(new Option(fromObj.options[i].text,fromObj.options[i].value),lengthOfToObj); toObj.options[lengthOfToObj].selected=true; fromObj.options[i].removeNode(true); } }} </script> 请继续。有问题。希望用table来做,加上div的innerhtml来拼右边的显示内容。 51job里面有这些东东的应用,偷来就是了 用js操作cookie以及在各浏览器中dom操作的差异的问题 如何在innerHTML里面加事件处理,如onclick 如何控制页面内的javascript执行顺序? 火狐与IE的区别引起?? 关于JS代码的执行问题 听说讯雷的表格框是由网页的,如何实现拉到标题改变其每个td的大小的效果呢 大家好,谁能帮我把这个javascript函数写到标签里面 一个菜鸟问题,请大家帮我看一下程序 如何在JavaScript脚本中调用VBScript函数 tomcat中jsp文件和java文件怎样部署 javaScript和asp混合书写的问题 写入COOKIE的问题
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Page Selection</title>
<style>
td{white-space:nowrap};
body{margin-left:0;margin-right:0;margin-top=0;margin-bottom=0};
</style>
</head><body bgcolor=eeeeee><table>
<tr >
<td>
<select name=SrcSelect size=6 style="font-size:11pt;width=200;height=160px" multiple >
<option value="1">test1</option>
<option value="2">test2</option>
<option value="3">test3</option>
<option value="4">test4</option>
<option value="5">test5</option>
<option value="6">test6</option>
</select>
</td>
<td align="center">
<input align="left" type=button value="→" onclick="moveLeftOrRight(document.all.SrcSelect,document.all.ObjSelect)" ><br><br>
<input align="left" type=button value="←" onclick="moveLeftOrRight(document.all.ObjSelect,document.all.SrcSelect)" >
</td>
<td>
<select name=ObjSelect size=6 style="font-size:11pt;width=200;height=160px" multiple >
<option value="11">test11</option>
<option value="12">test12</option>
<option value="13">test13</option>
<option value="14">test14</option>
<option value="15">test15</option>
<option value="16">test16</option>
</select>
</td>
<td>
<input type=button value="↑" onclick="moveUp()" ><br><br>
<input type=button value="↓" onclick="moveDown()" >
</td>
</tr>
</table>
</body>
<script language=javascript>
function moveUp()
{
var theObj=document.all.ObjSelect;
for(var i=1;i<theObj.length;i++)
{
if( theObj.options[i].selected && !theObj.options[i-1].selected )
{
var tempOption=new Option(theObj.options[i-1].text,theObj.options[i-1].value);
theObj.options[i-1].removeNode(true);
theObj.add(tempOption,i);
}
}
}
function moveDown()
{
var theObj=document.all.ObjSelect;
for(var i=theObj.length-2;i>-1;i--)
{
if( theObj.options[i].selected && !theObj.options[i+1].selected )
{
var tempOption=new Option(theObj.options[i].text,theObj.options[i].value);
theObj.options[i].removeNode(true);
theObj.add(tempOption,i+1);
theObj.options[i+1].selected=true;
}
}
}
function moveLeftOrRight(fromObj,toObj)
{
var lengthOfToObj=toObj.length;
for(var i=fromObj.length-1;i>-1;i--)
{
if(fromObj.options[i].selected)
{
toObj.add(new Option(fromObj.options[i].text,fromObj.options[i].value),lengthOfToObj);
toObj.options[lengthOfToObj].selected=true;
fromObj.options[i].removeNode(true);
}
}
}
</script>
希望用table来做,加上div的innerhtml来拼右边的显示内容。