Jump to content

Avoiding Page Jumping


aneellu
 Share

Recommended Posts

Hi all,I have a situation where in a user selects a value in a combo list it gets submitted to server on onchange event to populateother combo lists.I have many combo lists in a page and after user selects value in a combo list then page gets submitted to server and after return vertical scrollbar jumps to the top instead of staying at the position when a value was selectedbefore submitting.This is new to me. Whether this problem can be solved using javascript....Any idea or help is appreciated....Thanks,Anil.

Link to comment
Share on other sites

You might look into the scrollTop DOM property. If, just before you submit the form to the server, you tell the server what the current scrollTop value is for the body, the server could return that value back to the page in the response and you could have an onload event that looks for that scrollTop value from the server and then sets the position of the scrollbars to that value.Alternatively, depending on which server-side technology you are using, there may be a setting you can use on the server to remember scroll position for you. If you happen to be using ASP.NET, this search may come in handy:http://www.google.com/search?q=asp.net+scroll+position

Link to comment
Share on other sites

You might look into the scrollTop DOM property. If, just before you submit the form to the server, you tell the server what the current scrollTop value is for the body, the server could return that value back to the page in the response and you could have an onload event that looks for that scrollTop value from the server and then sets the position of the scrollbars to that value.Alternatively, depending on which server-side technology you are using, there may be a setting you can use on the server to remember scroll position for you. If you happen to be using ASP.NET, this search may come in handy:http://www.google.com/search?q=asp.net+scroll+position
Hi jesh,Thanks for the reply.......Iam using java as my server side technology. Can you redirect to me any usefull links that discuss the problem.thanks Anil
Link to comment
Share on other sites

  • 4 weeks later...
You might look into the scrollTop DOM property. If, just before you submit the form to the server, you tell the server what the current scrollTop value is for the body, the server could return that value back to the page in the response and you could have an onload event that looks for that scrollTop value from the server and then sets the position of the scrollbars to that value.Alternatively, depending on which server-side technology you are using, there may be a setting you can use on the server to remember scroll position for you. If you happen to be using ASP.NET, this search may come in handy:http://www.google.com/search?q=asp.net+scroll+position
Hi,Thanks alot for the hint you provided earlier :) I could use scrollTop DOM property to avoid Page Jumping, but i couldn't do it for anchor tag.when i click the anchor tag after postback it again jumps to the top.why scrollTop is not applicable to anchor tag....?Thanks in advance,Anil.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...