scrollPosition = window.frames[id].document.body.scrollTop;
The above code doesn't work correctly. Please tell me how to correct it.
scrollPosition = window.frames[id].document.body.scrollTop;
The above code doesn't work correctly. Please tell me how to correct it.
If the frame's document is located on a different domain, you will not be able to access most properties and objects on it due to the same origin policy.
Well, I think that what you're looking for is easy obtainable if you're using jQuery. So that might be worth looking into?
http://api.jquery.com/scrollLeft/ there is also scrollTop (api.jquery.com)
To get scrollTop in a crossbrowser way jQuery does this:
fucntion GetScrollTop()
{
var doc = document.documentElement
var body = document.body;
return ((doc && doc.scrollTop) || (body && body.scrollTop || 0)) - (doc.clientTop || 0);
}
I personally use simply this:
return document.documentElement.scrollTop || document.body.scrollTop