HTML & javascript: scrolling an iframe

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

HTML & javascript: scrolling an iframe

Post by ^rooker »

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:

Code: Select all

document.getElementById("iframe_id").scrollTo(x,y);
or:

Code: Select all

document.iframe_id.scrollTo(x,y);
but that didn't work.

I'm using the code in FireFox v3.6.4
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply