SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast vladanik's Avatar
    Join Date
    Oct 2001
    Location
    Belgrade, Serbia
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to load content for IFRAME from another IFRAME?

    Hi,

    I know basic JavaScript stuff, but I don't know much about
    DOM. Here is the problem. I have a page with 2 IFRAMEs
    in it. I have to change the content of one IFRAME
    form a page that's loaded in another IFRAME. How do
    I do this?

  2. #2
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <a href="newpage.html" onclick="parent.frames['destinationFrameid'].location.href = this.href; return false;">Link item</a>
    or if you want to keep it lean, flexible and reusable

    Code:
    <script type="text/javascript">
    
    function functionName(id,url) {
    parent.frames[id].location.href = url;
    }
    </script>
    
    ...
    
    <body>
    <a href="newpage.html" onclick="functionName('destinationFrameid',this.href);return false;">Link item</a>
    Hope this helps.
    Last edited by Bill Posters; Jan 7, 2003 at 08:59.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  3. #3
    SitePoint Enthusiast vladanik's Avatar
    Join Date
    Oct 2001
    Location
    Belgrade, Serbia
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot, that's what I needed


Bookmarks

Posting Permissions

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