I have a very extensive html form with multiple entries, after doing postback
my page is redirected to the top of the form, how do I, so when is to postback
return on the page where I left off? p>
I have a very extensive html form with multiple entries, after doing postback
my page is redirected to the top of the form, how do I, so when is to postback
return on the page where I left off? p>
You need to save the value of window.pageYOffset
( document.documentElement.scrollTop
to IE8) and restore as soon as your page loads again.
If you are using jQuery you can do this:
<form id="form1">
....
<input type="hidden" name="scrollto" id="scrollto" value="0" />
</form>
$.scrollTop
in scrollto
at the time the form is sent and restores the scroll position when the page loads. $(function(){
$('#form1').submit(function(){
$('#scrollto').val( $(window).scrollTop() );
});
$(window).scrollTop( $('#scrollto').val() );
});