记录DIV中滚动位置刷新页面位置保持不变

一、js部分:

<script type="text/javascript">
        $(document).ready(function () {
            $("#scroll").scroll(function () {
                Form1.divScrollValue.value = $("#scroll").scrollTop();
            });
        });
        function ScrollToSelectNode() {
            document.getElementById("scroll").scrollTop = "<%=ScrollValue%>";
        }

</script>

二、HTML部分

<body onload="ScrollToSelectNode()">

<input runat="server" id="divScrollValue" type="hidden" value="" />

<div class="air_1_2_1_2">
            <div class="air_1_2_1_2_1">摄像相列表</div>
            <div class="air_1_2_1_2_2" id="scroll">
                <TABLE id="CameraTable" cellSpacing="0" cellPadding="0" width="100%" border="0" runat="server"></TABLE>
            </div>
      
       </div>

</body>

三、C#后台:

public static string ScrollValue = string.Empty;//滚动条位置

protected void Page_Load(object sender, EventArgs e)
        {
            ScrollValue = divScrollValue.Value;

}

上一篇:2021CISCN-逆向-baby.bc-部分知识点总结


下一篇:Rancher2.x的安装与使用