<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <title>回到顶部</title> <script type="text/javascript" src="js/jquery.js"></script> <style> html,body {height:3200px} html,body,form,input,span,p,img,ul,ol,li,dl,dt,dd {margin:0; padding:0;border:0} a { text-decoration:none} a:hover {text-decoration:underline} #moquu_top{ z-index:2;50px;height:50px;right:30px; position:fixed;cursor:pointer;bottom:60px;background:#f00 url(../images/sbtn.png) 0 -101px;} #moquu_top:hover {background:#ff0 url(../images/sbtn.png) -50px -101px}
</style> </head> <body> <a id="moquu_top" href="javascript:"></a> </body> </html>
//返回顶部 function b() { h = $(window).height(), t = $(document).scrollTop()+h, t > h ? $("#moquu_top").show() : $("#moquu_top").hide() } $(document).ready(function() { b(), $("#moquu_top").click(function() { $(document).scrollTop(0) }) }), $(window).scroll(function() { b() });