熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

純文字版返回頂端的js代碼

2022-06-13   來源: JSP教程 
這篇文章介紹了純文字版返回頂端的js代碼有需要的朋友可以參考一下   復制代碼 代碼如下:

  
<script language="javascript">
var goto_top_type = ;
var goto_top_itv = ;
function goto_top_timer() {
 var y = goto_top_type == ? documentdocumentElementscrollTop
   : documentbodyscrollTop;
 var moveby = ;
 y = Mathceil(y * moveby / );
 if (y < ) {
  y = ;
 }
 if (goto_top_type == ) {
  documentdocumentElementscrollTop = y;
 } else {
  documentbodyscrollTop = y;
 }
 if (y == ) {
  clearInterval(goto_top_itv);
  goto_top_itv = ;
 }
}
function goto_top() {
 if (goto_top_itv == ) {
  if (documentdocumentElement && documentdocumentElementscrollTop) {
   goto_top_type = ;
  } else if (documentbody && documentbodyscrollTop) {
   goto_top_type = ;
  } else {
   goto_top_type = ;
  }
  if (goto_top_type > ) {
   goto_top_itv = setInterval(goto_top_timer() );
  }
 }
}
</script>
<a href="javascript:void()" onclick="goto_top()">【返回頂部】</a>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19977.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.