<div id="BackTop" style="position:fixed;bottom:60px;right:10px;display:none;cursor:pointer;"><a title="Top" onclick="window.scrollTo(0,0);return false;" href="#top" class="back-top">Top</a><img src="/images/back-top.png"/></div>
<script type="text/javascript">
idBackTop=document.getElementById('BackTop');
idBackTop.onclick=function (){
document.documentElement.scrollTop=0;
sb();
}
window.onscroll=sb;
function sb(){
if(document.documentElement.scrollTop==0){
idBackTop.style.display="none";
}else{
idBackTop.style.display="block";
}
}
</script>
<div id="Gotobottom" style="position:fixed;top:60px;right:10px;display:none;cursor:pointer;"><a title="bottom" onclick="window.scrollTo(0,0);return false;" href="#bottom" class="go-bottom">bottom</a><img src="/images/back-top.png"/></div>
<script type="text/javascript">
idGotobottom=document.getElementById('Gotobottom');
idGotobottom.onclick=function (){
document.documentElement.scrollTop=0;
sb();
}
window.onscroll=sb;
function sb(){
if(document.documentElement.scrollTop==0){
idBackTop.style.display="none";
}else{
idGotobottom.style.display="block";
}
}
</script>
不懂,能写个实例吗?按照我贴出来的您给改一下也成,谢谢了.
<div id="Gotobottom" style="position:fixed;top:60px;right:10px;display:none;cursor:pointer;"><a title="bottom" onclick="window.scrollTo(0,0);return false;" href="#bottom" class="go-bottom">bottom</a><img src="/images/back-top.png"/></div>
<script type="text/javascript">
idGotobottom=document.getElementById('Gotobottom');
idGotobottom.onclick=function (){
document.documentElement.scrollTop=0;
sb();
}
window.onscroll=sb;
function sb(){
if(document.documentElement.scrollTop==0){
idBackTop.style.display="none";
}else{
idGotobottom.style.display="block";
}
}
</script>
| 欢迎光临 全球主机交流论坛 (https://loc.888543.xyz/) | Powered by Discuz! X3.4 |