Results 1 to 6 of 6

Thread: One hyperlink Two urls

  1. #1
    Join Date
    Aug 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default One hyperlink Two urls

    Ok hi all
    i am a basic user and was wanting to know if it is possible to have a hyperlink set so it opens two urls
    i have a web page set out so that the user would select a link and it would open up the pages inside of iframes
    can anyone shed some light on to how i may get it so that not olny does it change the main iframe but also a banner at the top with a different url e.g a html file with an image for title


    thanks
    martyn

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Not sure what you mean by that last bit:
    Quote Originally Posted by martyn_green
    a html file with an image for title
    Anyways, two links for one can be done but, not with an ordinary hyperlink. You say you have two iframes. Give them each a name like:
    HTML Code:
    <iframe name="banner" src="banner1.htm" width="350" height="150" frameborder="0"></iframe>
    and later on in the page:
    HTML Code:
    <iframe name="main" src="main1.htm" width="650" height="450" frameborder="0"></iframe>
    Now, using javascript, we can target both on one click. Since I imagine the 'main' iframe is more important, we will make it the actual hyperlink and have the banner change use javascript:
    HTML Code:
    <a href="main2.htm" target="main" onclick="banner.location.href='banner2.htm';return true;">Click for main2.htm</a>
    You should choose the lesser important link for javascript (the onclick event) because non javascript enabled browsers will not be able to use it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hmmm ok i tried that
    and the banner doesnt change
    any ideas?
    thanks
    martyn

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

    Default

    Try:
    HTML Code:
    <a href="main2.htm" target="main" onclick="document.getElementsByName('banner')[0].location.href='banner2.htm';return true;">Click for main2.htm</a>
    This is a bit of a hack, but:
    Quote Originally Posted by FX JS console
    Error: blah is not defined
    Source File: javascript:alert(blah.innerHTML);
    Line: 1

    Error: document.blah has no properties
    Source File: javascript:alert(document.blah.innerHTML);
    Line: 1
    in this:
    HTML Code:
    <html>
    <title>None</title>
    <body>
    <div name="blah">Blah</div>
    </body>
    </html>
    There's probably some reason and easier way around this. I would use id here, usually.
    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!

  5. #5
    Join Date
    Aug 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok thanks ........ but does someone want to show me what to do with that one

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Before you go trying to figure out Twey's solution which I haven't really looked at (it may be fine), consider this, mine works here in IE6, FF1.0.7 and OP8. If you are having a problem with it:

    PLEASE: Include the URL to your problematic webpage that you want help with.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •