zoukankan      html  css  js  c++  java
  • 页面刷新后,Scroll仍在固定位置

    一。用javascript来控制

    <script language="javascript">

                         function savePos(){

                                    document.Form1.scrollingTopControlID.value = document.body.scrollTop;

                         }

                         function loadPos(){

                                    var top = document.Form1.scrollingTopControlID.value;

                                    if(top != "")

                                    {

                                    document.body.scrollTop = top;

                                    }

                         }

      </script>

    二。用body事件来触发

    <BODY onscroll="savePos();" onload="loadPos();" MS_POSITIONING="GridLayout">

    三。用隐藏框记录数值

    <input name="scrollingTopControlID" id="scrollingTopControlID" type="hidden" />

    这样就可以在页面刷新后重回到当前位置,适合版面较长的页面使用。

  • 相关阅读:
    UVa -- 401 Palindromes
    ffplay播放PCM裸流
    VLC2.2.4命令参数
    kurento搭建以及运行kurento-hello-world
    webrtp官方demo运行
    webrtc相关概念
    linux下面用Mingw编译libx264
    learning webrtc 使用node.js
    ffmpeg转码指南
    rtmpdump禁用openssl
  • 原文地址:https://www.cnblogs.com/huige1004/p/1298628.html
Copyright © 2011-2022 走看看