<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript">
function goTopEx(){
var obj=document.getElementById("goTopBtn");
function getScrollTop(){
return document.documentElement.scrollTop;
}
function setScrollTop(value){
document.documentElement.scrollTop=value;
}
window.οnscrοll=function(){getScrollTop()>0?obj.style.display="":obj.style.display="none";}
obj.οnclick=function(){
var goTop=setInterval(scrollMove,10);
function scrollMove(){
setScrollTop(getScrollTop()/1.1);
if(getScrollTop()<1)clearInterval(goTop);
}
}
}
</script>
<style type="text/css">
BODY
{
<!--演示效果实际用的时候可以去掉-->
height: 3600px;
}
#goTopBtn
{
position: fixed;
text-align: center;
line-height: 30px;
width: 30px;
bottom: 35px;
height: 33px;
font-size: 12px;
cursor: pointer;
right: 0px;
_position: absolute;
_right: auto;
}
</style>
<title></title>
</head>
<body style="text-align: center">
<div style="display: none" id="goTopBtn">
<img border="0" src="images/lanren_top.jpg"></div>
<script type="text/javascript">goTopEx();</script>
<p>
超出首屏范围,即会出现TOP按钮,否则自动隐藏。<br />
</p>
</body>
</html>