0
如何修改以下腳本以便能夠使用像這樣的簡單文本鏈接停止並啓用自動滾動鏈接 <a href="javascript:stopScroll()">Stop Scrolling</a>
? 謝謝。自動滾動啓用和禁用鏈接
<script>
(function() {
'use strict';
var dbh,sto,num=3,temp=0,scrolldelay=70;
function init(){
dbh=document.body.offsetHeight;
pageScroll();
}
function pageScroll() {
window.scrollBy(0,num);
temp+=num;
if((temp>=dbh)||(temp<=0)){
num=-num;
}
sto=setTimeout(function(){pageScroll();},scrolldelay);
}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
})();
</script>