473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to retain the scrollbar position?

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 2080
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

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

NS: window.pageYOffset
IE: document.body.scrollTop

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
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,...
4
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...
1
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,...
0
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...
6
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...
6
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...
5
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...
0
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...
1
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: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.