<script language="javascript">
var goto_top_type = ;
var goto_top_itv = ;
function goto_top_timer() {
var y = goto_top_type == ? documentdocumentElementscrollTop
: documentbodyscrollTop;
var moveby = ;
y = Mathceil(y * moveby / );
if (y < ) {
y = ;
}
if (goto_top_type == ) {
documentdocumentElementscrollTop = y;
} else {
documentbodyscrollTop = y;
}
if (y == ) {
clearInterval(goto_top_itv);
goto_top_itv = ;
}
}
function goto_top() {
if (goto_top_itv == ) {
if (documentdocumentElement && documentdocumentElementscrollTop) {
goto_top_type = ;
} else if (documentbody && documentbodyscrollTop) {
goto_top_type = ;
} else {
goto_top_type = ;
}
if (goto_top_type > ) {
goto_top_itv = setInterval(goto_top_timer() );
}
}
}
</script>
<a href="javascript:void()" onclick="goto_top()">【返回頂部】</a>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20569.html