Easy to resolve page after return page scrolling to the top

Source: Internet
Author: User
Resolution | page easy to resolve page after return page scrolling to the top

Page after the page to scroll to the top, causing the problem is the page return, is actually equal to load a page, the new loaded page will be fixed-point to the top of the page. This feature will cause very poor user experience, how to solve this problem, we can use the hidden viewstate mechanism to save the current page scrolling position, after the page return call.


<%@ Page language= "C #" codebehind= "Test_THIN.aspx.cs" autoeventwireup= "false" inherits= "EIM.web.Test_THIN"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<title>Test_THIN</title>
<meta name= "generator" content= "Microsoft Visual Studio 7.0" >
<meta name= "Code_language" content= "C #" >
<meta name= "vs_defaultClientScript" content= "JavaScript" >
<meta name= "vs_targetschema" content= "http://schemas.microsoft.com/intellisense/ie5" >
<script language= "JavaScript" >
function Savescroll ()
{
var hid = document.getElementById ("hid");
Hid.value = Document.body.scrollTop;
}
function Getscroll ()
{
var hid = document.getElementById ("hid");
Hid.value = Document.body.scrollTop;
Document.body.scrollTop = Hid.value;
}
</script>
</HEAD>
<body ms_positioning= "GridLayout" onload= "Getscroll ()" Onscroll= "Savescroll ()" >
<form id= "Test_thin" method= "POST" runat= "server" onsubmit= "Savescroll ()" >
<input style= "Z-INDEX:101; left:216px; Position:absolute; Top:127px "type=" hidden "id=" hid "runat=" Server ">
<asp:button id= "Button1" style= "z-index:102; left:37px; Position:absolute; TOP:1529PX "runat=" Server "text=" button "></asp:Button>
</form>
</body>
</HTML>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.