时间:2021-07-01 10:21:17 帮助过:6人阅读
sortitems = 1; // Automatically sort items within lists? (1 or 0)分享到:
function move(fbox,tbox) {
for(var i=0; iif(fbox.options[i].selected && fbox.options[i].value != "") {
var no = new Option();
no.value = fbox.options[i].value;
no.text = fbox.options[i].text;
tbox.options[tbox.options.length] = no;
fbox.options[i].value = "";
fbox.options[i].text = "";
}
}
BumpUp(fbox);
if (sortitems) SortD(tbox);
}
function BumpUp(box) {
for(var i=0; iif(box.options[i].value == "") {
for(var j=i; jbox.options[j].value = box.options[j+1].value;
box.options[j].text = box.options[j+1].text;
}
var ln = i;
break;
}
}
if(ln < box.options.length) {
box.options.length -= 1;
BumpUp(box);
}
}
function SortD(box) {
var temp_opts = new Array();
var temp = new Object();
for(var i=0; itemp_opts[i] = box.options[i];
}
for(var x=0; xfor(var y=(x+1); y if(temp_opts[x].text > temp_opts[y].text) {
temp = temp_opts[x].text;
temp_opts[x].text = temp_opts[y].text;
temp_opts[y].text = temp;
temp = temp_opts[x].value;
temp_opts[x].value = temp_opts[y].value;
temp_opts[y].value = temp;
}
}
}
for(var i=0; ibox.options[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
}
}