手工排序 |
<script language=javascript> var seqSelect=document.forms[0].seqItem; var length=5; //go top function doTopItem(){ var length=seqSelect.options.length; var topV,topT; var tempV=new Array(); var tempT=new Array(); for(var i=0;i i){ break; } else{ seqSelect.options[j].value=tempV[j-1]; seqSelect.options[j].text=tempT[j-1]; } } } } seqSelect.options[0].selected=true; } //go bottom function doBottomItem(){ var length=seqSelect.options.length; var bottomV,bottomT; var tempV=new Array(); var tempT=new Array(); for(var i=0;i =0;j--){ tempV[j]=seqSelect.options[j].value; tempT[j]=seqSelect.options[j].text; alert(tempV+" ··· "+tempT); if(j==(length-2)){ seqSelect.options[length-2].value=bottomV; seqSelect.options[length-2].text=bottomT; } else if(j function add_singer(object,value,text)//添加数据 { if(singer_exist(object,value)==false) { object.options.add(new Option(text,value,true,true)); return true; } return false; } function remove_singer(object,index)//删除数据 { if(index<0)return false; object.options.remove(index) } function singer_exist(object,value)//检查是否存在 { for(var i=0;i