转自: http://bbs.blueidea.com/thread-2705905-1-1.html
<html>
<body>
<script>
function sortList(listId) {
var lst = document.getElementById(listId);
var options = [];
while(lst.options.length)
options.unshift(lst.removeChild(lst.options[lst.options.length - 1]));
options.sort(function(a,b){return a.text > b.text?1:(a.text < b.text?-1:0)});
while(options.length)
lst.appendChild(options.shift());
lst = null;
}
</script>
<select id="myList" multiple size="6">
<option value="0">AKE001</option>
<option value="1">AKE003</option>
<option value="2">AKE002</option>
<option value="3">AKE006</option>
<option value="4">AKE004</option>
<option value="5">AKE005</option>
</select>
<input type="button" value="排序" onclick="sortList('myList')">
</body>
<html>
<body>
<script>
function sortList(listId) {
var lst = document.getElementById(listId);
var options = [];
while(lst.options.length)
options.unshift(lst.removeChild(lst.options[lst.options.length - 1]));
options.sort(function(a,b){return a.text > b.text?1:(a.text < b.text?-1:0)});
while(options.length)
lst.appendChild(options.shift());
lst = null;
}
</script>
<select id="myList" multiple size="6">
<option value="0">AKE001</option>
<option value="1">AKE003</option>
<option value="2">AKE002</option>
<option value="3">AKE006</option>
<option value="4">AKE004</option>
<option value="5">AKE005</option>
</select>
<input type="button" value="排序" onclick="sortList('myList')">
</body>
<html>