Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where scrolled at when user clicked? 1

Status
Not open for further replies.

xenology

Programmer
May 22, 2002
51
US
I have a div tag set to scrollable (overflow:auto). In the div tag i have a table. The div area is set big enough to view 10 rows of the table and the table has 100 rows (each with an anchor). Clicking a cell in the table carries you to another page where the user can enter or alter data that shows up in that cell. When they save/submit, they are returned to the original page with the updated info.

How do i know where that cell was scrolled at in the div tag when the user clicked it and how do i display the updated page scrolling to that same spot (so the user doesn't have to scroll again).

Say the user scrolled so that cell in row 13 was visible in the 10 row window and it was second from bottom. When i go back to the page, how do i know it was second from the bottom and how do i scroll so that it is there again?
 
When they save/submit, they are returned to the original page with the updated info.
Actually, they are returned to an all new page as far as the browser is concerned. You might try passing a parameter and using JavaScript to scroll, but then that question would be better suited for the JavaScript forum forum216.


Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Grab the scrollTop value from the div when the page is submitted, then when the page is reloaded, set the scrollTop value of the div back to the value you pulled before the submission. scrollTop is a readable and writable value.

-kaht

Looking for a puppy? [small](Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)[/small]
 
Perfect kaht! Exactly what I needed and very easy to do! I set a hidden tag value to the scrollTop value of myDiv and then passed it back in and set on PageLoad and it's exactly where the user clicked!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top