zoukankan      html  css  js  c++  java
  • sharepoint 2010 页面刷新时滚动条位置保持不变 Controlling scrollbar position on postback

    在sharepoint 2010中,如果当前页面的篇幅比较长,如何在拉动页面滚动条时,在刷新的条件下,保持滚动条位置,研究了一下,发现sharepoint 2010的母板页,和普通的asp.net页面有不太一样的地方,是通过一个属性document.getElementById("s4-workspace").scrollTop来控制的,以下是实现的脚本,只需要修改一下v4.master母版页,在里面添加一个javascript的方法。

    <style>
    html
       {
    overflow: auto;
       }
    /*better than on the body*/
    body
       {
    xoverflow: hidden; /*Needed to eliminate scrollbars*/
    background: #000;
    font: normal80%/1.4verdana,arial,sans-serif;
       }
    </style>
    <script>
       window.onload = function () {
           document.getElementById("s4-workspace").scrollTop = 1;
           document.body.scroll = 'yes';
           document.getElementById("s4-workspace").style.overflow = 'auto';
       }
    </script>

    在IE7,IE8,IE9,Google Chrome谷歌浏览器中,测试通过。

  • 相关阅读:
    用两个栈实现队列
    *重建二叉树
    *链表中环的入口结点
    *复杂链表的复制
    替换空格
    python多线程文件拷贝
    进程、线程、协程
    文件处理工具sed、awk
    CentOs软件安装
    python logging模块
  • 原文地址:https://www.cnblogs.com/batter152/p/3530709.html
Copyright © 2011-2022 走看看