|
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>图片上下滚动</title> </head> <BODY> <div id=makewing style="height:60;"> <table width="778" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td height="60" bgcolor="#66CCFF" align="center"> 内容1 </td> </tr> <tr> <td height="60" bgcolor="#FFCC66" align="center"> 内容2 </td> </tr> <tr> <td height="60" bgcolor="#99CC66" align="center"> 内容3 </td> </tr> </table> </div> <div id="bb" style="margin-left:450px;"> <input type="button" value="上翻" /> <input type="button" value="下翻" /> </div> </BODY> <script type="text/javascript"> marqueesHeight=60; stopscroll=false; with(bb){ onmouseover=new Function("stopscroll=true"); onmouseout=new Function("stopscroll=false"); } with(makewing){ style.height=marqueesHeight; style.overflowX="visible"; style.overflowY="hidden"; noWrap=true; onmouseover=new Function("stopscroll=true"); onmouseout=new Function("stopscroll=false"); } preTop=0; currentTop=10; stoptime=0; makewing.innerHTML+=makewing.innerHTML; scoll=0;scollup=0;scolldown=0;t=10; function init_srolltext(id){ if(id==0){ makewing.scrollTop=0; scoll=setInterval("scrollUp(0)",1); }else if(id==1){ if(scollup==0){ stopscroll=false; scollup=setInterval("scrollUp(1)",1); } }else{ if(scolldown==0){ stopscroll=false; scolldown=setInterval("scrollUp(-1)",1); } } }function scrollUp(id){if(id==0){if(stopscroll==true) return;currentTop+=1;if(currentTop==11){ stoptime+=1; currentTop-=1; if(stoptime==300) { currentTop=0; stoptime=0; }}else { if(300==makewing.scrollTop){ makewing.scrollTop=120; makewing.scrollTop+=6; }else{ makewing.scrollTop+=6; }}}else if(id==1){ window.clearInterval(scoll); t--; if(t==0){ window.clearInterval(scollup); stopscroll=true; scoll=setInterval("scrollUp(0)",1); t=10; scollup=0; } if(300==makewing.scrollTop){ makewing.scrollTop=120; makewing.scrollTop+=6; }else{ makewing.scrollTop+=6; } }else{ window.clearInterval(scoll); t--; if(t==0){ window.clearInterval(scolldown); stopscroll=true; scoll=setInterval("scrollUp(0)",1); t=10; scolldown=0; } if(0==makewing.scrollTop){ makewing.scrollTop=180; makewing.scrollTop-=6; }else{ makewing.scrollTop-=6; } }}init_srolltext(0);</script></HTML> |
|