SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Now with customized title Jump's Avatar
    Join Date
    Sep 2002
    Location
    The Restaurant at The End of The Universe
    Posts
    1,423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Works in frames, but not iframes.

    This is a bit of code I have used in the past to open multiple files in multiple frames. Anyone know how to make it work for inline frames?

    PHP Code:
      <script language="JavaScript"
            
    type="text/javascript">
      
    //<![CDATA[
      
    <!-- Begin
      
    function loadFrames(frame1,page1,frame2,page2,frame3,page3) {
      eval(
    "parent."+frame1+".location.href='"+page1+"'");
      eval(
    "parent."+frame2+".location.href='"+page2+"'");
      eval(
    "parent."+frame3+".location.href='"+page3+"'");
      }
      
    // End -->
      //]]>
      
    </script> 

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi jump,

    Quite ugly method..
    Try this

    HTML Code:
    <script type="text/javascript">
    // Jump new function
    function loadIframe( id, src ) {
       document.getElementById( id ).src = src;
    }
    </script>
    Short, huh?
    Just call it like this:
    HTML Code:
    <iframe [b]id="myid1"[/b] ></iframe>
    <iframe [b]id="myid2"[/b] ></iframe>
    <iframe [b]id="myid3"[/b] ></iframe>
    
    <script type="text/javascript">
      loadIframe( 'myid1', 'http://google.com' );
      loadIframe( 'myid2', 'http://yahoo.com' );
      loadIframe( 'myid2', 'http://altavista.com' );
    </script>
    Good luck,
    -Guillermo

  3. #3
    Now with customized title Jump's Avatar
    Join Date
    Sep 2002
    Location
    The Restaurant at The End of The Universe
    Posts
    1,423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, it is very old code.

    So would that work in both?

    Thanks by the way.

  4. #4
    Now with customized title Jump's Avatar
    Join Date
    Sep 2002
    Location
    The Restaurant at The End of The Universe
    Posts
    1,423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The above code works in the document to link to the iframe. However, it doesn't link from within an iframe to another iframe. How would I do that? I tried adding parent but it didn't work.


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
  •