javascript thread: Please help. Positioning problem.
Hi Jay,
You almost had it. The property you need is the scrollTop and scrollLeft
for the body tag. So the code would be:
window.onscroll = function() {
var iLeftRelative = document.body.scrollLeft;
var iTopRelative = document.body.scrollTop;
var divDisplay = document.getElementById('divCommands');
divDisplay.style.left = iLeftRelative + 10;
divDisplay.style.top = iTopRelative + 10;
}
Good luck
Philip
|





