• 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;    

                 }                     

           }  

           }

  • 相关阅读:
    java_爬虫_从腾讯视频播放界面爬取视频真实地址
    杂_小技巧_将网页上的内容通过亚马逊邮箱传到kindle中
    java_基础_接口和抽象类
    知乎上的50道SQL练习题
    第 4 章 WebDriver API
    第 2 章 测试环境搭建
    第 1 章 自动化测试基础
    【软件测试】9.QC管理学习(类禅道)学习
    01 Python简介、环境安装、变量、数据类型
    【MySQL面试指南】
  • 原文地址:https://www.cnblogs.com/yangfeizbj/p/2831436.html
Copyright © 2020-2023  润新知