Results 1 to 3 of 3

Thread: Changing 2 Iframes with 1 hyperlinked picture

  1. #1
    Join Date
    Nov 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Changing 2 Iframes with 1 hyperlinked picture

    Ok I have a website where I use two Iframes, One Iframe selects a product, the other Iframe brings up the fabric selection, I want to be able to use a picture of a product category to change both Iframe 1 and Iframe 2.

    I am very Java Unsavvy so if someone could help me out with both the eg

    "Picture (onClick .... Do procedure double hyperlink)"

    Refers to the Javascript Function that says

    "Doublehyperlink = Iframe1 = blah.html and Iframe 2 = blah2.html"

    You see what I mean? I know what it should do but I dont know how to put that into Javascript


    Thanks in advance

    John

  2. #2
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    easy. don't do a hyperlink. use onClick. onclick="function1tochange();function2tochange();".

    -magicyte

  3. #3
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    A quick script:

    Code:
    function linkr(){
      document.frames["iframe1"].location.href = "./something.html"
      document.frames["iframe2"].location.href = "./somethingelse.html"
    }
    A quick example:

    Code:
    <img src="myImage.jpg" alt="My PICTURE!" onClick="linkr()"/>
    Keep in mind that depending on the names of the pages you are redirecting to, that one function could become a lot more powerful with a few modifications. For instance, let's say you have a picture of a hotdog. Iframe1 goes to hotdog.html, iframe2 goes to hotdogInfo.html.

    Code:
    function linkr(whereTo){
      document.frames["iframe1"].location.href = "./" + whereTo + ".html"
      document.frames["iframe2"].location.href = "./" + whereTo + "info.html"
    }
    Code:
    <img src="myImage.jpg" alt="My PICTURE!" onClick="linkr('hotdog')"/>
    Then, you could add a picture of a hamburger, and link to "hamburger.html" and "hamburgerinfo.html" by only changing that image's "linkr('hamburger')". Just depends what your overall goal is.
    Verzeihung!

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
  •