<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
<script>
$(function(){
$(window).scroll(function(){
if($(window).scrollTop()>100){
$("#gototop").css("display",'block');
}else{
$("#gototop").css("display",'none');
}
})
})
function setscroll(){
$(window).scrollTop(1);
}
</script>
</head>
<body>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<div style="position:fixed;right:0;bottom:0;display:none;" id='gototop'><input type="button" onclick="setscroll()" value='回到顶部'/></div>
</body>
</html>
转载于:https://my.oschina.net/cxz001/blog/98020