<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>function 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 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>