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;    

                 }                     

           }  

           }

  • 相关阅读:
    iOS开发之单例模式
    XCode 安装 Alcatraz包管理器失败的处理
    iOS "此证书由未知颁发机构签名"此问题的解决方法
    Android WebView 使用
    BaseActivity
    定时周期执行指定的任务 ScheduledExecutorService
    SQLite数据库浅谈
    android 图片缓存
    Android之drawable state各个属性详解
    Android应用中如何启动另一个应用
  • 原文地址:https://www.cnblogs.com/yangfeizbj/p/2831436.html
Copyright © 2011-2022 走看看