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 8 of 8
  1. #1
    Regular Coder oldcrazylegs's Avatar
    Join Date
    Feb 2004
    Location
    East Moline Illinois USA
    Posts
    414
    Thanks
    4
    Thanked 5 Times in 4 Posts

    Smile Side-By-Side Iframes

    Several years ago I said I wanted two side-by-side iframes. I wanted to load a menu of text links into one iframe, click on those links and have them open documents in the other iframe.

    Someone pasted a JavaScript in here that made that possible. But I have lost that somehow. Can someone show me how to do that again. I'd like to use that on my own start page I use on my hard drive.

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    If you have two iframes and each has an id (say, "iframeA" and "iframeB"), then each can reference the other via the parent. So a link in iframeA can have
    Code:
    href="javascript:void(0);" onclick="parent.iframeB.src='documentA.html';"
    Very rudimentary.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #3
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    i wrote an example code for someone here some time ago:
    http://freedockstar.com/iframeParent.php

    you can use this mechanism to send data from one ifrane to another
    only restriction: they need to be in the same domain or you have to set propper headers

    -------------------------------------------------------------------------------
    "Real Programmers can write assembly code in any language" - Larry Wall

  • #4
    Regular Coder oldcrazylegs's Avatar
    Join Date
    Feb 2004
    Location
    East Moline Illinois USA
    Posts
    414
    Thanks
    4
    Thanked 5 Times in 4 Posts

    Side-By-Side Iframes

    That way doesn't work. I don't think you understood my question. The way you are talking about would only work it the link is on the page outside of the iframe.

    I want to load an HTML menu with text links in iframeA

    I want to click on those link inside iframeA and have them load html files/urls etc in iframeB.

    What they gave me before was like this. In iframeA there was a javascript in the head tags like this <script></script> and some more javascript in the text links.

  • #5
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    of course it will. in example i gave you you have a way to send command from iframe to parent and from parent to iframe. what more do you need?

    -------------------------------------------------------------------------------
    "Real Programmers can write assembly code in any language" - Larry Wall

  • #6
    Regular Coder oldcrazylegs's Avatar
    Join Date
    Feb 2004
    Location
    East Moline Illinois USA
    Posts
    414
    Thanks
    4
    Thanked 5 Times in 4 Posts
    i finally found it on hard drive stuck way back in an old folder i forgot i still had. the way you showed me doesn't work but this one will. thanks anyway.

  • #7
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    god sure it would. i even coded a line especially for you there right now
    http://freedockstar.com/iframeParent.php

    -------------------------------------------------------------------------------
    "Real Programmers can write assembly code in any language" - Larry Wall

  • #8
    Regular Coder oldcrazylegs's Avatar
    Join Date
    Feb 2004
    Location
    East Moline Illinois USA
    Posts
    414
    Thanks
    4
    Thanked 5 Times in 4 Posts

    Smile Side-By-Side Iframes

    Here is the coe for what I was talking about. You'll see it works great.

    The Iframe HTML

    Code:
    <table align="center" cellspacing="0" cellpadding="0">
    <tr>
    <td><iframe src="menu.html" id="left" width="200" height="300"></iframe></td>
    <td><iframe src="introduction.html" id="right" width="400" height="300"></iframe></td>
    </tr></table>
    Load this page in the left Iframe

    Code:
    <html>
    <head>
    <script type="text/javascript" language="javascript">
    <!--
    function changePage(url)
    {
    top.document.getElementById('right').src=url;
    }
    //-->
    </script>
    </head>
    <body bgcolor="white" text="black" link="blue">
    
    <p>Click on the links below to load them in the right Iframe.</p>
    
    <p><a href="javascript:void(0)" onclick="changePage('introduction.html');">
    Introduction Page</a></p>
    
    <p><a href="javascript:void(0)" onclick="changePage('subpage1.html');">
    Subpage #1</a></p>
    
    <p><a href="javascript:void(0)" onclick="changePage('subpage2.html');">
    Subpage #2</a></p>
    
    <p><a href="javascript:void(0)" onclick="changePage('subpage3.html');">
    Subpage #3</a></p>
    
    </body>
    </html>
    Make several HTML pages to load into the right IFrame when you click on those links. It works great


  •  

    Posting Permissions

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