語法說明:
1.在 if (position !=300) 中修改捲軸捲動的距離
<!--自動捲軸_開始--> <script language="JavaScript"> <!-- var position = 0; function scroller() { if (position !=300) { position++; parent.scroll(100,position);clearTimeout(timer); var timer = setTimeout("scroller()",0); timer; } } --> </script> <body onload="scroller()"> <!--自動捲軸_結束--> |
nicole 發表在 痞客邦 留言(0) 人氣(99)
自動捲軸(二)
<!--自動捲軸_開始--> <script language="JavaScript"> <!-- var speed=1 var currentpos=0,alt=1,curpos1=0,curpos2=-1 function initialize(){ startit() } function scrollwindow(){ if (document.all) temp=document.body.scrollTop else temp=window.pageYOffset if (alt==0) alt=1 else alt=0 if (alt==0) curpos1=temp else curpos2=temp if (curpos1!=curpos2){ if (document.all) currentpos=document.body.scrollTop+speed else currentpos=window.pageYOffset+speed window.scroll(0,currentpos) } else{ currentpos=0 window.scroll(0,currentpos) } } function startit(){ setInterval("scrollwindow()",10) } window.onload=initialize --> </script> <!--自動捲軸_結束-->
|
nicole 發表在 痞客邦 留言(0) 人氣(110)