复制代码代码如下所示:



列表测试



附注1:左右运动的选择


注:本页仅测试IE6 / firefox1.5.other浏览器或其他版本下不测试。







<选择srcselect大小=6风格=字体大小:11pt;宽度:160px;身高:160px
多=多鼠标双击=moveleftorright(document.frm.srcselect,文档。FRM。objselect)>
讲师



onclick=moveleftorright(document.frm.srcselect,文档。FRM。objselect)>





<选择objselect大小=6风格=字体大小:11pt;宽度:160px;身高:160px
多=多鼠标双击=moveleftorright(document.frm.objselect,文档。FRM。srcselect)>
教学管理
超级管理员







移动
功能上(){
无功theobjoptions = document.frm.objselect.options;
对于(var i = 1;i < theobjoptions.length;i++){
如果我选择(theobjoptions { }!theobjoptions { 1 }我{选择)。
swapoptionproperties(theobjoptions {我},{ 1 }我theobjoptions);
}
}
}



函数向下移动(){
无功theobjoptions = document.frm.objselect.options;
对于(var i = theobjoptions.length - 2;我1;我--){
如果我选择(theobjoptions { }!theobjoptions {我+ 1 }。选择){
swapoptionproperties(theobjoptions {我},{我theobjoptions + 1 });
}
}
}


功能swapoptionproperties(选项,选择2){
无功tempstr = option1.value;
option1.value = option2.value;
option1.value = tempstr;
tempstr = option1.text;
option1.text = option2.text;
option2.text = tempstr;
tempstr = option1.selected;
option1.selected = option2.selected;
option2.selected = tempstr;
}


移动位置列表框
功能moveleftorright(从OBJ,toobj){
对于(var i = 0;i < fromobj.length;i++){
无功srcoption =从OBJ选项{我};
如果(srcoption。选择){
toobj.appendchild(srcoption);
我--;
}
}
}