<script language=javascript> function moveUp() { var i=document.all.CSSelect.selectedIndex; document.all.CSSelect.options[i].swapNode(document.all.CSSelect.options[(i==0)?(document.all.CSSelect.length-1):i-1]); }
function moveDown() { var i=document.all.CSSelect.selectedIndex; document.all.CSSelect.options[i].swapNode(document.all.CSSelect.options[(i<document.all.CSSelect.length-1)?(i+1):0]); }
if (selectIndex==0)
{
alert("已经到最上面了!");
}
else
{
selected=routine.address.options[selectIndex].text;
up=routine.address.options[selectIndex-1].text;
routine.address.options[selectIndex].text=up;
routine.address.options[selectIndex-1].text=selected;
}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head><body bgcolor=eeeeee>
<table>
<tr >
<td>
<select name=CSSelect size=6 >
<option value="11" selected >test11</option>
<option value="12">test12</option>
<option value="13">test13</option>
<option value="14">test14</option>
<option value="15">test15</option>
</select>
</td>
<td>
<input type=button value="↑" name=ToUpButton onclick="moveUp()" ><br><br>
<input type=button value="↓" name=ToDownButton onclick="moveDown()" >
</td>
</tr>
</table>
</body>
<script language=javascript>
function moveUp()
{
var i=document.all.CSSelect.selectedIndex;
document.all.CSSelect.options[i].swapNode(document.all.CSSelect.options[(i==0)?(document.all.CSSelect.length-1):i-1]);
}
function moveDown()
{
var i=document.all.CSSelect.selectedIndex;
document.all.CSSelect.options[i].swapNode(document.all.CSSelect.options[(i<document.all.CSSelect.length-1)?(i+1):0]);
}
</script>
同意JK_10000(JK)