//备份时间 排序 //向右 function TimeListBoxRight() { var leftlb = document.getElementById("xuanyongTimelb"); var rightlb = document.getElementById("keyongTimelb");
var arrtext = new Array(); var arrvalue = new Array(); var arrtag = new Array(); var arrindex = new Array();
var j = 0; for (var i = 0; i < leftlb.options.length; i++) { if (leftlb.options[i].selected == true) { //leftlb.options.add(new Option(rightlb.options[i].text, rightlb.options[i].value)); //rightlb.options.remove(i); arrtext[j] = leftlb.options[i].text; arrvalue[j] = leftlb.options[i].value; arrtag[j] = leftlb.options[i].getAttribute("tag"); arrindex[j] = i; j++; } }
//添加 for (var k = 0; k < arrvalue.length; k++) { var opt = new Option(); opt.value = arrvalue[k]; opt.text = arrtext[k]; opt.setAttribute("tag", arrtag[k]); rightlb.options[rightlb.options.length] = opt; }
//冒泡排序 for (var m = 0; m < rightlb.options.length - 1; m++) { for (var l = 0; l < rightlb.options.length - 1 - m; l++) { if (Number(rightlb.options[l].getAttribute("tag")) > Number(rightlb.options[l + 1].getAttribute("tag"))) {
var temp = new Option(); temp.value = rightlb.options[l].value; temp.text = rightlb.options[l].text; temp.setAttribute("tag", rightlb.options[l].getAttribute("tag"));
//删除 for (var n = arrindex.length - 1; n >= 0; n--) { leftlb.options.remove(arrindex[n]); }
if (leftlb.options.length <= 0) { $("#righttimeid").disable = true; }
}
//Item 向左 function TimeListBoxLeft() { var leftlb = document.getElementById("xuanyongTimelb"); var rightlb = document.getElementById("keyongTimelb");
var arrtext = new Array(); var arrvalue = new Array(); var arrtag = new Array(); var arrindex = new Array();
var j = 0; for (var i = 0; i < rightlb.options.length; i++) { if (rightlb.options[i].selected == true) { //leftlb.options.add(new Option(rightlb.options[i].text, rightlb.options[i].value)); //rightlb.options.remove(i); arrtext[j] = rightlb.options[i].text; arrvalue[j] = rightlb.options[i].value; arrtag[j] = rightlb.options[i].getAttribute("tag"); arrindex[j] = i; j++; } }
//添加 for (var k = 0; k < arrvalue.length; k++) { var opt = new Option(); opt.value = arrvalue[k]; opt.text = arrtext[k]; opt.setAttribute("tag", arrtag[k]); leftlb.options[leftlb.options.length] = opt; }
//冒泡排序 for (var m = 0; m < leftlb.options.length - 1; m++) { for (var l = 0; l < leftlb.options.length - 1 - m; l++) { if (Number(leftlb.options[l].getAttribute("tag")) > Number(leftlb.options[l + 1].getAttribute("tag"))) {
var temp = new Option(); temp.value = leftlb.options[l].value; temp.text = leftlb.options[l].text; temp.setAttribute("tag", leftlb.options[l].getAttribute("tag"));