Results 1 to 6 of 6

Thread: How do you make one link go to two different destinations in two different iframes?

  1. #1
    Join Date
    Jun 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool How do you make one link go to two different destinations in two different iframes?

    Let me explain. You click on the link. You get to www.a.com in one iframe, and www.b.com in the other. Mmhmm. I want the code. How do you do itttt.

  2. #2
    Join Date
    Jun 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yeah okay. Email me if you know how to.... cruel.lovely@gmail.com.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The only way is to use a client-side scripting language. In Javascript:
    HTML Code:
    <a href="javascript:void();" onclick="document.getElementById('idOfFrameA').location = 'www.a.com'; document.getElementById('idOfFrameB').location = 'www.b.com';">Link Text</a>
    ... and create two frames with ids.

    By the way, if you can possibly avoid it... don't use iframes.
    Last edited by Twey; 06-21-2005 at 03:10 PM. Reason: Typo
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi all first time post...

    This is the exact problem Im having but I cant seem to get this to work (Im not a very good programmer ) Heres my code:

    <tr>
    <td width="2" valign="middle" class="text1">&gt;</td>
    <td width="103" valign="middle" class="text1"><a href="javascript:void();" onclick="document.getElementById('middle').location = 'includes/news.htm'; document.getElementById('frame').location = 'link.htm';" class="text1">Home</a>
    </td>
    </tr>

    Can someone give me some pointers?

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    href="javascript:void();"
    You should try to avoid using useless hrefs if possible. In this case, a better idea would probably be to link to the most prominent of the pages linked to.
    Also, consider using location.href instead of location.

    You should include the code for the frames themselves (frame and middle). If you haven't got these frames, then that's the problem.
    Also, if you're using frames instead of iframes, you shouldn't access them via document.getElementById(); you should use parent.framename instead.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    You should try to avoid using useless hrefs if possible. In this case, a better idea would probably be to link to the most prominent of the pages linked to.
    Also, consider using location.href instead of location.

    You should include the code for the frames themselves (frame and middle). If you haven't got these frames, then that's the problem.
    Also, if you're using frames instead of iframes, you shouldn't access them via document.getElementById(); you should use parent.framename instead.
    Ok, apologese, as I said, Im not very good at programming!! Have I not put the code for middle and frame in already? (everything has been created). And what exactly do you mean by 'useless' href's? I was only copying the code you gave, does this have to be changed to suit me specifically? and if so, how??

    Thankyou!

    PS I also need it to work in Firefox too.
    Last edited by obifenobi; 07-13-2005 at 05:27 PM.

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
  •