コードをコピー コードは次のとおりです: list测试 注1:左右移动进行选取 注:本页面仅在IE6/FireFox1.5下测试过。其它浏览器或其它版本未经测试。 multiple="multiple" ondblclick="moveLeftOrRight(document.frm.SrcSelect,document.frm.ObjSelect) "> 讲师 multiple="multiple" ondblclick="moveLeftOrRight(document.frm.ObjSelect,document.frm.SrcSelect) "> 教学管理员 超级管理员 <br>//上移<br> function moveUp() {<br> var theObjOptions = document.frm.ObjSelect.options;<br> for (var i = 1; i < theObjOptions.length; i++) {<BR> if (theObjOptions[i].selected && !theObjOptions[i - 1].selected) {<BR> swapOptionProperties(theObjOptions[i], theObjOptions[i - 1]);<BR> }<BR> }<BR> }</P> <P><BR>//下移<BR> function moveDown() {<BR> var theObjOptions = document.frm.ObjSelect.options;<BR> for (var i = theObjOptions.length - 2; i > -1; i--) {<br> if (theObjOptions[i].selected && !theObjOptions[i + 1].selected) {<br> swapOptionProperties(theObjOptions[i], theObjOptions[i + 1]);<br> }<br> }<br> }<p><br> function swapOptionProperties(option1, option2) {<br> var tempStr = option1.value;<br> option1.value = option2.value;<br> option1.value = tempStr;<br> tempStr = option1 .text;<br> option1.text = option2.text;<br> option2.text = tempStr;<br> tempStr = option1.selected;<br> option1.selected = option2.selected;<br> option2.selected = tempStr;<br> }</p> <p><br>//列表の位置移動<br> function moveLeftOrRight(fromObj, toObj) {<br> for (var i = 0; i < fromObj.length; i ) {<br> var srcOption = fromObj.options[i];<br> if (srcOption.selected) {<br> toObj.appendChild(srcOption);<br> i--;<br> }<br> }<br> }<br>< ;/スクリプト> <br></p> </div>