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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript link from page in iframe to parent, with anchor

    Hello

    I have a problem with getting this to work:

    A larger page largetest.php has an iframe. The page in the iframe is smalltest.php.
    Smalltest.php has two small thumnail images as links.
    These are red.jpg and blue.jpg.
    Clicking on the red image refreshes the parent page largetest.php and this link uses a link to an ID #footer, like a named anchor.
    Same happens with the blue image link.

    Link code on the smalltest page in the iframe:

    <a href='javascript: parent.location.href="largetest.php#footer"'>
    <img src="graphics/red.jpg" width="95" height="62" border="0"/></a>
    <a href='javascript: parent.location.href="largetest.php?name=George"+"#footer"'>
    <img src="graphics/blue.jpg" width="95" height="62" border="0"/></a>

    When the larger page refreshes, it reloads the smalltest page in the iframe.
    All works fine, even if the links have query strings like the 'blue' link, if the blue link is clicked, then red, then blue etc,
    but fails if red link clicked, and then after pages refresh is clicked again.
    Then the iframe page smalltest fails to display and it just shows the link text in the iframe, with no page present.

    It fails when either image link is clicked more than once in succession.
    red blue red blue: fine
    red red: fails.

    Without the '#footer' in the links, there is no problem, but I need the largetest page to display the bottom half of the page.

    Could be a cache problem?

    Can anyone help with this?

  • #2
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is now resolved. Just using onclick instead of pseudo-link

  • #3
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    target="parent"?

    Code:
    <a href="largetest.php#footer" target="_parent"><img src="graphics/red.jpg" width="95" height="62" border="0" /></a>
    <a href="largetest.php?name=George#footer" target="_parent"><img src="graphics/blue.jpg" width="95" height="62" border="0" /></a>


  •  

    Posting Permissions

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