js实现置顶

//-----------点击事件---------------

onclick="Topfun()"

//-----------js代码---------------

<script type="text/javascript">
var four;
function Topfun(){
four=setInterval(FourscrollBy,10);
}
function FourscrollBy(eachHeight){
if(document.documentElement && document.documentElement.scrollTop) //IE
{
if(document.documentElement.scrollTop<=0){
clearInterval(four);
}else{
window.scrollBy(0,-30);
}
}else{ //Chrome不支持documentElement.scrollTop
if(document.body.scrollTop<=0){
clearInterval(four);
}else{
window.scrollBy(0,-30);
}
}
}
</script>

来源:http://blog.csdn.net/tc_16_zl/article/details/78684545

上一篇:Linux下安装cmake


下一篇:linux下安装安装pcre-8.32