<div class="codetitle"> <span><a style="CURSOR: pointer" data="21473" class="copybut" id="copybut21473" onclick="doCopy('code21473')"><u>复制代码</u></a></span>如下代码:</div> <div class="codebody" id="code21473"> <br><script language="javascript"><BR>var goto_top_type = -1;<BR>var goto_top_itv = 0;<BR>函数 goto_top_timer() {<BR> var y = goto_top_type == 1 ? document.documentElement.scrollTop<BR> : document.body.scrollTop;<BR> var moveby = 15;<BR> y -= Math.ceil(y * moveby / 100);<BR> if (y < 0) {<BR> y = 0;<BR> }<BR> if (goto_top_type == 1) {<BR> document.documentElement.scrollTop = y;<BR> } else {<BR> document.body.scrollTop = y ;<BR> }<BR> if (y == 0) {<BR> clearInterval(goto_top_itv);<BR> goto_top_itv = 0;<BR> }<BR>}<BR>函数 goto_top() {<BR> if (goto_top_itv == 0) {<BR> if (document.documentElement && document.documentElement.scrollTop) {<BR> goto_top_type = 1;<BR> } else if (document.body && document.body.scrollTop) {<BR> goto_top_type = 2;<BR> } else {<BR> goto_top_type = 0;<BR> }<BR> if (goto_top_type > 0) {<BR> goto_top_itv = setInterval('goto_top_timer()', 50); <BR> }<BR> }<BR>}<BR></script><br><a href="javascript:void(0)" onclick="goto_top()">【返回顶部】< ;/a><br> </div>