javascript滾動條,動態加載內容

<!DOCTYPE html PUBliC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="http://www.miiceic.org.cn/templets/js/jquery-1.3.1.js"></script>
<title>企業培訓,it培訓,數據庫培訓,android培訓,嵌入式培訓</title>
</head>  
   <script type="text/javascript">
    function insertcode(){
        var $body = $("body");                                                           
        $body.append('<p style=\" height:1000px; font-size:24px;\"><a href=\"http://www.miiceic.org.cn/\" target=\"_blank\">企業培訓</a><br /><a href=\"http://www.amboedu.com/\" target=\"_blank\">職業教育</a><br /><a href=\"http://www.ciitn.com/\" target=\"_blank\">信息產業培訓網</a><br /><a href=\"http://www.miiceic.org.cn/amt2011/\" target=\"_blank\">android PK Iphone</a><br /></p>')
        $("#page_tag_load").hide();                   
        }
    function endcode(){
        $("#page_tag_load").hide();
    }
    $(document).ready(function(){
         $(window).scroll(function () {
              var $body = $("body");
              var $html = "";
              $html += "<br/>" + ($(window).height() + $(window).scrollTop());
              $html += "<br/>window.height: " + $(window).height();
              $html += "<br/>body.height: " + $body.height();
              $html += "<br/>window.scrollTop: " + $(window).scrollTop();
              $("#page_tag_bottom").html($html);

             /*判斷窗體高度與豎向滾動位移大小相加 是否 超過內容頁高度*/
              if (($(window).height() + $(window).scrollTop()) >= $body.height()) {
                  $("#page_tag_load").show();
                  //setTimeout(insertcode, 1000);/*IE 不支持*/
                  if(($(window).height() + $(window).scrollTop())<3000){   
                      insertcode();
                  }
                  else{
                      endcode();   
                  }
              }
          });
      });
    </script>
</head>

<body>
    <p style="height:1000px; font-size:24px;"><a href="http://www.miiceic.org.cn/" target="_blank">企業培訓</a><br /><a href="http://www.amboedu.com/" target="_blank">職業教育</a><br /><a href="http://www.ciitn.com/" target="_blank">信息產業培訓網</a><br /><a href="http://www.miiceic.org.cn/amt2011/" target="_blank">Android PK Iphone</a><br /><br /><br /><a href="http://www.miiceic.org.cn/amt2011/" target="_blank">跨領域技術體驗峰會</a></p>
    <p id="page_tag_bottom" style="width:100%; position:fixed; _position:absolute;top:0px; background-color:#cccccc;height:120px;"></p>
    <p id="page_tag_load" style=" display:none; font-size:14px;position:fixed; bottom:0px; background-color:#cccccc;height:50px;">加載中…</p>
</body>
</html>
作者“jjklmm”

發佈留言