zoukankan      html  css  js  c++  java
  • document.documentElement.scrollTop Google Chrome 不 兼容

       SetScroll();       

      function SetScroll() {

                if (window.attachEvent) {         

            window.attachEvent("onscroll", SaveScrollValue);     

            }           

      else {      

               window.addEventListener("scroll", SaveScrollValue, false);       

             }        

    }         

    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(SetScrollValue);     

         function SaveScrollValue(sender, args) {

                var scrollTemp = document.getElementById("<%=HiddenFieldScroll.ClientID%>");     

            if (scrollTemp != null)            

         scrollTemp.value = document.body.scrollTop + document.documentElement.scrollTop;     

        }

            function SetScrollValue(sender, args) {        

                var scrollTemp = document.getElementById("<%=HiddenFieldScroll.ClientID%>");       

          if (scrollTemp != null)             {       

              //window.scroll(0, scrollTemp.value);     

                document.documentElement.scrollTop = scrollTemp.value;        

             if (document.documentElement.scrollTop == 0) {        

                 document.body.scrollTop = scrollTemp.value;    

                 }                     

           }  

           }

  • 相关阅读:
    洛谷 P3521 [POI2011]ROT-Tree Rotations 解题报告
    洛谷 P1640 [SCOI2010]连续攻击游戏 解题报告
    vector-pop_back
    vector-push_back
    vector-push_back
    vector-max_size
    vector-max_size
    vector-insert
    vector-insert
    vector-front
  • 原文地址:https://www.cnblogs.com/yangfeizbj/p/2831436.html
Copyright © 2011-2022 走看看