//-----------点击事件---------------
οnclick="Topfun()"
//-----------js代码---------------
<script type="text/javascript">
var four;function Topfun(){ four=setInterval(FourscrollBy,10);}function FourscrollBy(eachHeight){ if(document.documentElement && document.documentElement.scrollTop) //IE{ if(document.documentElement.scrollTop<=0){ clearInterval(four);}else{ window.scrollBy(0,-30);}}else{ //Chrome不支持documentElement.scrollTopif(document.body.scrollTop<=0){ clearInterval(four);}else{ window.scrollBy(0,-30);}}}</script>
来源:http://blog.csdn.net/tc_16_zl/article/details/78684545