当前位置:网站首页 - 特效代码 - 窗口特效
  • <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>排序</title> <script> var x=null; var listObj=null; //鼠标按下不放时的操作 function setTimeStart(type) { listObj=document.getElementById('forder'); //超过0.3秒启动连续的向上(下)的操作 if(type=="up") { x=setTimeout(upListItem,300); }else { x=setTimeout(downListItem,300); } } //将选中item向上 function upListItem() { var selIndex=listObj.selectedIndex; if(selIndex<0) { if(x!=null){clearTimeout(x);} return; } if(selIndex==0) { if(x!=null){clearTimeout(x);} return; } var selValue=listObj.options[selIndex].value; var selText=listObj.options[selIndex].text; listObj.options[selIndex].value=listObj.options[selIndex-1].value; listObj.options[selIndex].text=listObj.options[selIndex-1].text; listObj.options[selIndex-1].value=selValue; listObj.options[selIndex-1].text=selText; listObj.selectedIndex=selIndex-1; if(selIndex+1>0) { x=setTimeout(upListItem,200) } } //将选中item向下 function downListItem() { var selIndex=listObj.selectedIndex; if(selIndex<0) { if(x!=null){clearTimeout(x);} return; } if(selIndex==listObj.options.length-1) { if(x!=null){clearTimeout(x);} return; } var selValue=listObj.options[selIndex].value; var selText=listObj.options[selIndex].text; listObj.options[selIndex].value=listObj.options[selIndex+1].value; listObj.options[selIndex].text=listObj.options[selIndex+1].text; listObj.options[selIndex+1].value=selValue; listObj.options[selIndex+1].text=selText; listObj.selectedIndex=selIndex+1; if(selIndex+1<listObj.options.length-1) { x=setTimeout(downListItem,200) } } </script> </head> <body topMargin="20px" leftMargin="10px" rightMargin="0"> <TABLE id="Table1" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0"> <TR> <TD vAlign="top"> <TABLE id="Table4" cellSpacing="0" cellPadding="0" width="100%" border="0"> <TR> <TD><INPUT class="upBtn" type="button" value="向上↑" onmousedown="setTimeStart('up');" onmouseup="clearTimeout(x);" onclick="listObj=document.getElementById('forder');upListItem();clearTimeout(x);" ID="Button1" NAME="Button1"> <INPUT style="WIDTH: 48px; HEIGHT: 22px" type="button" value="↓向下" class="downBtn" onmousedown="setTimeStart('down');" onmouseup="clearTimeout(x);" onclick="listObj=document.getElementById('forder');downListItem();clearTimeout(x);" ID="Button2" NAME="Button2"> </TD> </TR> <TR> <TD> <SELECT id="forder" style="WIDTH: 304px; HEIGHT: 240px" size="15"> <OPTION value=1>欧莱开主题网</OPTION> <OPTION value=2>酷站欣赏</OPTION> <OPTION value=3>图库素材</OPTION> <OPTION value=4>网页代码</OPTION> <OPTION value=5>脚本特效</OPTION> <OPTION value=6>www.2008php.com</OPTION> <OPTION value=7>web.2008php.com</OPTION> <OPTION value=8>abc.2008php.com</OPTION> <OPTION value=9>9</OPTION> </SELECT></TD> </TR> </TABLE> </TD> </TR> </TABLE> </body> </html>