I have got a DIV with a scroll ( overflow: scroll) in an aspx page and when page is post back the scroll is reset to top position. So I try to set back to the position before the post back, but I found an issue in FF.

(I remove all the logic to reproduce this issue)

Basically I register a function on the AJAX end request:


In this functionI try to set the scroll of the div

var t = document.getElementById(tmp);
t.scrollTop = 250;

The div is long enough (for this example) and this code working fine in IE, so the div scroll to 250 and if I try to read t.scroll (with a button after the page has finised reloading), it returns 250. In FF, it scrolls to 45, but if I try less than 45 it scrolls fine (so if I set t.scrollTop = 30; then it scrolls to 30).

What I found is if I put an alert() before it works fine in FF as well!!

var t = document.getElementById(tmp);
t.scrollTop = 250;

Someone said to put "px" (t.scrollTop = 250 + "px"), but it isnt working at all.

Could somebody help me?

Thank you