FF allows the style "position:fixed;". That will fix the element in a certain position relative to the screen.
You can emulate it with IE and other browsers by creating a DIV as the first child of the body to emulate the body.
Remove all padding, spacing, borders from the BODY and also set "scroll:none;overflow:hidden;" in CSS and in javascript disable the scroll.
Then give your DIV thats emulating the body a overflow:auto;.
Then when you want to make a DIV fixed, just place it outside the DIV that you are using as the BODY, and make it absolutely positioned.
See an example:
http://tagsoup.com/cookbook/css/fixed/
This is better to moving the Element when onscroll is triggered.
If you want to go with onscroll event, then don't jump directly to the scroll offset, use an incremental approach...
pseudo code:
while (body_scroll_offset > absolute_div_position) { absolute_div_position++ }