读书人

两个select列表互相移动

发布时间: 2013-12-02 12:00:40 作者: rapoo

两个select列表相互移动




<html>
<head><title></title></head>
<body>

多选框 arrayList 以ascii进行排序

<table>
<tr><td>
<select id="first" name="first" multiple="multiple" style="height:200px;width:100px" >
<option value="1">blue</option>
<option value="2">red</option>
<option value="3">white</option>
<option value="4">001</option>
<option value="5">1000</option>
</select>

</td>
<td>
<input type="button" value=">>" onclick="moveright()" style="width:100px"/>
<br />
<input value="<<" type="button" onclick="moveleft()" style="width:100px" />
<br />
<input value=">>>" type="button" onclick="moveallright()" style="width:100px"/>
<br />
<input value="<<<" type="button" onclick="moveallLeft()" style="width:100px"/>
</td>

<td>
<select id="secord" name="secord" multiple="multiple" style="height:200px;width:100px">
</select>
</td>
</tr>
</table>

</body>

<script type="text/javascript">

function moveright(){
var srcList = document.getElementById("first");
var destList = document.getElementById("secord");
moveList(srcList,destList,false);
}

function moveleft(){
var srcList = document.getElementById("secord");
var destList = document.getElementById("first");
moveList(srcList,destList,false);
}

function moveallright(){
var srcList = document.getElementById("first");
var destList = document.getElementById("secord");
moveList(srcList,destList,true);
}

function moveallLeft(){
var srcList = document.getElementById("secord");
var destList = document.getElementById("first");
moveList(srcList,destList,true);
}
}

newDestList.sort(function(a,b){return a.text>b.text?1:-1});

读书人网 >Web前端

热点推荐