Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2006
    Location
    Illinois
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Jump to Parent Anchor From Within iFrame Using Target

    Does anyone know how to put code on an included iframe which will cause the page to jump to a specific anchor point on the parent page? When I try the following, it only jumps to the top of the iframe and not to the top of the parent. I basically want it to scroll all the way to the top of the parent page as soon as the page loads.

    Code:
    window.location = "#top";
    Thanks!
    Sarah

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,325
    Thanks
    6
    Thanked 1,208 Times in 1,178 Posts
    How about:
    Code:
    window.parent.location ="#top"
    ?

    http://developer.mozilla.org/en/docs/DOM:window.parent

  3. #3
    New Coder
    Join Date
    Aug 2006
    Location
    Illinois
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That actually caused the iframe to break out of the parent, so that none of the parent is visible.
    Sarah

  4. #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Give this a try

    parent.scrollTo(0,0)
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •