提示:您可以先修改部分代碼再運行
javascript 向上滾動效果代碼<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.111cn.net/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>javascript 向上滾動效果代碼</title><script language="javascript">//對象向上滾動函數function start_upmarquee(lh,speed,delay,index_obj){//參數(lh)表示移動對象的顯示高度//參數(speed)表示移動速度//參數(delay)表示處理移動延遲時間//參數(index_obj)表示處理移動的DIV標識ID參數var the_time;var the_stop=false;var moveObj=document.getElementById(index_obj);moveObj.innerHTML+=moveObj.innerHTML;moveObj.onmouseover=function(){the_stop=true}moveObj.onmouseout=function(){the_stop=false}moveObj.scrollTop = 0;function start(){the_time=setInterval(scrolling,speed);if(!the_stop) moveObj.scrollTop += 2;}function scrolling(){if(moveObj.scrollTop%lh!=0){moveObj.scrollTop += 2;if(moveObj.scrollTop>=moveObj.scrollHeight/2) moveObj.scrollTop = 0;}else{clearInterval(the_time);setTimeout(start,delay);}}setTimeout(start,delay);}</script></head><body ><div id="sc">fdasfdsafdsafdsafdsa<br />f<br />dsafdsafdsafdas<br />fdasfdsaf<br /></div><script language="javascript">start_upmarquee(10,1,5,'sc');</script></body></html>
提示:您可以先修改部分代碼再運行