html代码:
js代码:
var isie6 = window.XMLHttpRequest ? false : true;
function newtoponload() {
var c = document.getElementById("back-to-top");
function b() {
var a = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
if (a > 0) { if (isie6) { c.style.display = "none"; clearTimeout(window.show); window.show = setTimeout(function () { var d = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; if (d > 0) { c.style.display = "block"; c.style.top = (500 + d) + "px" } }, 300) } else { c.style.display = "block" } } else { c.style.display = "none" } } if (isie6) { c.style.position = "absolute" } window.onscroll = b; b() } if (window.attachEvent) { window.attachEvent("onload", newtoponload) } else { window.addEventListener("load", newtoponload, false) } document.getElementById("back-to-top").onclick = function () { window.scrollTo(0, 0) };
.go_top{ position:fixed; right:100px; bottom:230px;}
.go_top a{ width:50px; height:50px; display:block; overflow:hidden; text-indent:-999px; background:url(../images/back-to-top.gif) 0 0 no-repeat #000; border-radius:25px;}
.go_top a:hover{background:url(../images/back-to-top.gif) 0 0 no-repeat #F00;}
所用到的图片:
效果图:
简单的办法就是锚记链接 给最上面加上锚记 给下面加上返回 或者你去http://www.lanrentuku.com/js/piaofu.html找
楼上的回答是正解了,大概就是这样操作。不知道你看明白没有,不行你再追问就好。