HTML & javascript: scrolling an iframe
Posted: Thu Sep 16, 2010 2:53 pm
After reading through tons of documentation about frame scrolling, I didn't manage to find proper documentation about javascript objects and properties that would actually work to scroll an iframe.
Finally, I found the missing information on a page about "scrolling an iframe with javascript" that contained a piece of information missing on all other sites I found:
document.getElementById("iframe_id").contentWindow.scrollTo(x,y);
Many other pages, tutorials, howtos, etc said it should simply be:
or:
but that didn't work.
I'm using the code in FireFox v3.6.4
Finally, I found the missing information on a page about "scrolling an iframe with javascript" that contained a piece of information missing on all other sites I found:
document.getElementById("iframe_id").contentWindow.scrollTo(x,y);
Many other pages, tutorials, howtos, etc said it should simply be:
Code: Select all
document.getElementById("iframe_id").scrollTo(x,y);
Code: Select all
document.iframe_id.scrollTo(x,y);
I'm using the code in FireFox v3.6.4