473,769 Members | 6,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to retain the scrollbar position?

8 New Member
Hello experts here,
plz help me,
When I Scroll down my web page using vertical scroll bar to some point and when refreshed, I was

unable to retain back the scrolled position, instead it always goes to the top part of the page.

How can I retain this scrolled position even after refreshing the page ?
a piece of code helps.
Thanks and Regards,
SrinivasKota.
Sep 9 '07 #1
1 2105
gits
5,390 Recognized Expert Moderator Expert
hi ...

welcome to TSDN ...

let me give you an idea for that: you need to retrieve the Y-scrollbar-position:

NS: window.pageYOff set
IE: document.body.s crollTop

and on page-refresh you use (in onload of the document's body):

Expand|Select|Wrap|Line Numbers
  1. window.scrollTo(x, y);
where y is your retrieved position (x might be 0). now your problem is ... how to store the retrieved position? :) ... you may use a cookie or pass it with a query string, or whatever ... so onload of the page you may ask for the y-position of the scrollbar and set it with scrollTo() ...

kind regards
Sep 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7492
by: alvinpoon | last post by:
Hello, I have a problem setting the scrollbar position of a div region on a webpage which is posted at http://www.geocities.com/virtuosity999/Logon.htm If the page is loaded with Netscape, the vertical scrollbar on the left side will be moved down a little bit but if the page is loaded with Internet explorer, the scrollbar remains at the top of the scroll area.
4
16446
by: Paul T. RONG | last post by:
Dear all, Can one control the subform scrollbar through vba? For example, I would like to make two command buttons on the main form to control the subform scrollbar. Click 1st button the subform vertical scrollbar goes down to the end, click 2nd button goes up to the top position. Thank you for your help,
1
8501
by: gmtongar | last post by:
Hi, I've made a custom scrollbar which consists of three buttons and a panel. My problem is: How do I move it like a scrollbar slider? I've tried DoDragDrop, but it does not appear to be the same, all though I can move the button. I have also used the mouseMove event, so I can move the button, but it's completely out of control. Still I feel it's the right way to go. This is what I've written: private void btnSecond_MouseMove(object sender,...
0
1489
by: ZenMaster | last post by:
Hello, can anyone help me figure out what may be wrong with my code - In VC++ 6.0 Ive created a ScrollBar using : -------------------------------------------- hwndScrollHue = CreateWindowEx (WS_EX_OVERLAPPEDWINDOW, "SCROLLBAR", (LPSTR) NULL, WS_CHILD | SBS_HORZ, 5, 100, 80, 16, hForm, (HMENU) NULL, hInstance, (LPVOID) NULL);
6
2511
by: Jorge Luzarraga Castro | last post by:
Hey, hope you can help with this. I have an aspx page which contains several User Control. At the beggining there´s only one visible User Control but after working with the page additional UC begin showing up which means the page gets longer so the scroll bar is needed to reach the ones at the bottom. The problem I have is that when I´m working with the user control at the bottom of the page and this page needs to be reloaded the...
6
10939
by: Colin McGuire | last post by:
Hello experts, this is a repost but I have been (much) more clear. I want to know the position of the horizontal scrollbar in a textbox as a percentage - if the horizontal scrollbar is hard left, I want to display 0% on the form. - if the horizontal scrollbar is smack in the middle, I want to display 50% on the form. - if the horizontal scrollbar is 2/3rd along the X-axis,
5
22551
by: Frank Rizzo | last post by:
I reload the items in the listview on a regular schedule (i.e. clear the listview, then load it up with fresh values). I want add a convinience to the user whereby my application remembers the position of the scrollbars after reloading the data. But I can’t figure out how to retrieve the scrollbar position (both horizontal and vertical). Neither can I figure out how to restore the state of the scrollbars. I could theoretically figure...
0
1464
by: onzinnig | last post by:
Hello, I have a problem where a frame does not repaint a part of a window when using the horizontal scrollbar. Easier then explaining is to try out the two html pages at the bottom of this question. After creating page 1.html and 2.html in root drive c:\ e.g. load 2.html in IE (6.0).
1
1756
by: qhimq | last post by:
Hi, I have a lot of edit child windows and text painted on a windows application made from the API all at runtime. How do I go about making the scrollbar to move them all? What I attempted: in the WM_PAINT message I have it paint a big red (later I will make white) rectangle filling the full window then it paints the text into its new position. The new position is takin from its initial position - the position of the scrollbar. For...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.