View Full Version : scroll to top with iFrame and anchor link

05-18-2006, 07:08 AM
Been beating my head against the wall on the one for a while now. I have a page with an iFrame. The src of the iFrame is a page with an anchor link. When the iFrame src URL jumps to the #anchor, the outer window scrolls down as well. Ugh. Here's what I'm talking about:


I tried adding a self.scrollTo(0, 0) line of javascript at the bottom of the parent page, and on the onload of the iFrame, but neither worked. If I add that code to a link or button, however, I can scrollTo the top of the page onClick no problem.

So, anyone know how I can scroll the outer window back to the top when the page loads? Thanks!

05-18-2006, 06:55 PM
Hi ChitownE,

Add a setTimeout like below:

Page Bottom

Mr J
05-18-2006, 11:30 PM
Take a look here, this may help