What I feared had happened. I developed a web page amd tested it in Opera, and it doesn't work in IE6.
This is the code snippet:
Code:
<script type="text/javascript">
scrollTo(0,344);
alert ('current position after scroll: ' + document.body.scrollTop);
</script>
Now obviously the page does NOT scroll to y position 344. In the last line, the alert shows the current and correct scroll position.
In other words, retrieving the scroll position works fine, but setting of the scroll position does not.
Alternatively I tried this code:
Code:
<script type="text/javascript">
document.body.scrollTop = 344;
alert ('current position after scroll: ' + document.body.scrollTop);
</script>
But that didn't work either.
As a matter of fact, there seems to be no relationship between what I put the scroll position to, and the real position after the call.
These are a number of requested positions, and the real position the scroll position moves to:
Code:
requested actual
230 203
324 135
523 94
Now I don't see any logic here.
In Opera it works perfectly. In Firefox it does not, but that is due to a (documented) different way of specifying the scroll position.
If anyone ever succesfully scrolled the window in IE to a predetermined position, please let me know!
jlinkels