html代码:
javascript代码:
for(var i = 0; i < 100; i++){
document.write("<li>" + i + "</li>"); } function back(){ var back = document.getElementById("back"); var iSpeed = 40; var time = setInterval(function(){ var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; if(scrollTop > 0){ document.body.scrollTop = document.documentElement.scrollTop =scrollTop/3 - iSpeed; }else{ clearInterval(time); } },100) }