<style type="text/css">#div1{width:67px;height:114px;right:4px;bottom:5px;cursor:pointer; background:url(/images/return_top.gif) no-repeat;position:fixed;_position:absolute;display:none; color:#FFFFFF}</style><script language="javascript" type="text/javascript"> function getScroll(id){ var obj = document.getElementByIdx_x(id); var timer = null; positionFixed(obj);if(obj){ obj.style.display = 'none'; window.οnscrοll=function(){ getScrollTop() > 0 ? obj.style.display = "block" : obj.style.display = "none"; } obj.οnclick=function(){ var timer = setInterval(sMove,10); function sMove(){ setScrollTop(getScrollTop() / 1.5); if(getScrollTop() < 1)clearInterval(timer); } } }}//判断IE6function positionFixed(obj){ var iE6 = !-[1,] && !window.XMLHttpRequest; if(obj){ var top = obj.offsetTop; if(iE6){ document.documentElement.style.textOverflow = "ellipsis"; obj.style.position = "absolute"; obj.style.setexpression_r("top", "eval_r(documentElement.scrollTop + " + top + ') + "px"'); } }}//获取滚动条Topfunction getScrollTop(){ return document.documentElement.scrollTop || document.body.scrollTop;}//回到顶部function setScrollTop(value){ document.documentElement.scrollTop = value; document.body.scrollTop = value;}window.onload = function(){getScroll('div1');};</script><html><title></title><body> <div id="div1"></div> </body></html>
转载于:https://www.cnblogs.com/475089730/archive/2012/11/14/2769862.html