// Sorting: Move upward
Function up ()
... {
var sel = document.GetelementByid ("Selectcheck"); // Get selection
var nindex = sel.selectIndex;/ /The index of the select item that needs to be operated
var nLen = sel.length; //The total number of select items
if ((nLen if (nIndex ...{
alert("Please select a selected button to move!");
return;
} }
var sValue=sel.options[ nIndex].value;
var sHTML=sel.options[nIndex].innerHTML;
sel.options[nIndex].value=sel.options[nIndex-1].value;
sel.options[ nIndex].innerHTML=sel.options[nIndex-1].innerHTML; > sel.selectedIndex=nIndex-1; );
var nIndex = sel.selectedIndex;
var nLen = sel.length;
if ((nLen if ( nIndex ...{
alert("Please select a selected button to move! ");
return; }
var sValue=sel.options[nIndex].value;
var sHTML=sel.options[nIndex].innerHTML; sel.options[nIndex ].value=sel.options[nIndex 1].value;
sel.options[nIndex].innerHTML=sel.options[nIndex 1].innerHTML;
sel.options[nIndex 1].value=sValue ; sel.options[nIndex 1].innerHTML=sHTML; sel.selectedIndex=nIndex 1;
}
//Move to the top
function UpFirst()
. . .{
var sel=document.getElementById("selectCheck");
var nIndex = sel.selectedIndex;
var nLen = sel.options.length;
if ((nLen
if(nIndex ...{
alert("Please select a selected button to move!");
return;
}
var tempValue = document.getElementById("tempValue");//用于临时存放option的值
tempValue.value = "";
for(var k=0;k
tempValue.value = sel.options[k].value ";";
}
var arrValue = tempValue.value.split(';');
var sValue=sel.options[nIndex].value;
var sHTML=sel.options[nIndex].innerHTML;
sel.options[0].value = sValue;
sel.options[0].innerHTML = sHTML;
for(var j=1;j ...{
sel.options[j].value = arrValue[j-1];
sel.options[j].innerHTML = arrValue[j-1];
}
sel.selectedIndex = 0;
}
//移动到最后
function DownLast()
...{
var sel=document.getElementById("selectCheck");
var nIndex = sel.selectedIndex;
var nLen = sel.options.length;
if ((nLen
if(nIndex ...{
alert("请选择一个要移动的已选按钮!");
return;
}
var tempValue = document.getElementById("tempValue");//用于临时存放option的值
tempValue.value = "";
for(var k=nIndex 1;k
tempValue.value = sel.options[k].text ";";
}
var arrValue = tempValue.value.split(';');
var sValue=sel.options[nIndex].value;
var sHTML=sel.options[nIndex].innerHTML;
for(var j=nIndex;j
sel.options[j].value = arrValue[j-nIndex ];
sel.options[j].innerHTML = arrValue[j-nIndex];
}
sel.options[nLen-1].value = sValue;
sel.options[nLen-1].innerHTML = sHTML;
sel.selectedIndex = nLen-1;
}