<html>
<head>
<script type="text/javascript">
var currentPositiontimer;
function GoTop(){
timer=setInterval("runToTop()");
}
function runToTop(){
currentPosition=documentdocumentElementscrollTop || documentbodyscrollTop;
currentPosition=;
if(currentPosition>)
{
windowscrollTo(currentPosition);
}
else
{
windowscrollTo();
clearInterval(timer);
}
}
</script>
<style type="text/css">
</style>
</head>
<body>
<div style="height:px;textalign:center;fontsize:px;fontweight:bold;">飯</div>
<div style="height:px;textalign:center;fontsize:px;fontweight:bold;">吃</div>
<div style="height:px;textalign:center;fontsize:px;fontweight:bold;">家</div>
<div style="height:px;textalign:center;fontsize:px;fontweight:bold;">回</div>
<div style="height:px;textalign:center;fontsize:px;fontweight:bold;">你</div>
<div style="height:px;textalign:center;fontsize:px;fontweight:bold;">帶</div>
<div id="backup" onclick="GoTop()"
style="border:px solid red;height:px;width:px;
position:fixed;cursor:pointer;right:px;bottom:px;">
返回頂部
</div>
<script>
windowscrollTo(documentbodyscrollHeight);
</script>
</body>
</html>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20247.html