标签:返回顶部 style java ext javascript width
<style>
#linGoTopBtn {
POSITION: fixed;
TEXT-ALIGN: center; LINE-HEIGHT: 30px; WIDTH: 30px; BOTTOM: 35px; HEIGHT: 33px;
FONT-SIZE: 12px; CURSOR: pointer; RIGHT:
0px;
}
</style>
<script>
function
linGoTop()
{
var obj =
document.getElementById("linGoTopBtn");
function
getScrollTop()
{
return document.documentElement.scrollTop;
}
function setScrollTop(value)
{
document.documentElement.scrollTop ? document.documentElement.scrollTop =
value : document.body.scrollTop = value;
}
window.onscroll = function()
{
getScrollTop() > 0 ?
obj.style.display =‘‘ : obj.style.display = ‘none‘;
}
obj.onclick = function()
{
var goTop = setInterval(scrollMove, 5); //
单位毫秒
function
scrollMove()
{
setScrollTop(getScrollTop()/1.1);
if(getScrollTop() < 1)
clearInterval(goTop);
}
}
}
</script>
</head>
<body
style="text-align:center">
<DIV style="DISPLAY: none"
id="linGoTopBtn"><IMG border=0
src="images/top.jpg"></DIV>
<SCRIPT
type="text/javascript">linGoTop();</SCRIPT>
</body>
</html>
javascript 返回顶部,布布扣,bubuko.com
标签:返回顶部 style java ext javascript width
原文地址:http://www.cnblogs.com/lin3615/p/3703641.html