①select.options("id")方法取出一个option
②证明option的索引不能通过option.index来更改其索引值
③通过option的swapNode方法来交换索引
④选取一个Item
通过select的selectIndex来选中一个option
如果该Item有id,可以通过id值来选取该Item: options("hong")
0
1
2
3
4
function setOrder(f){
var sel=document.forms[0].menu;
var seloption=sel.options[sel.selectedIndex];
//alert(seloption.index);
if(f==1){
if((seloption.index-1)>=0)
seloption.swapNode(sel.options[seloption.index-1]);
}
else{
if((seloption.index+1)
seloption.swapNode(sel.options[seloption.index+1]);
}
}
分享到:
2008-10-18 20:38
浏览 674
评论