Change onClick result

Discussion in 'JavaScript' started by egdcltd, Sep 19, 2006.

  1. #1
    Currently I have a javascript:window.open onClick handler on a webpage, which brings up a popup of another webpage when clicked. This will cause problems when links in that window are clicked on. Is there anyway of making the onClick add the file to the existing webpage, rather than bringing up a popup?
     
    egdcltd, Sep 19, 2006 IP
  2. VONRAT

    VONRAT Banned

    Messages:
    181
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hehe could only think of using iframes or ajax for that purpose :)
     
    VONRAT, Sep 20, 2006 IP
  3. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think iframes might work, there are two other pages already included using that method; however, they are active all the time, and I am after something that will open only when a button is clicked.
     
    egdcltd, Sep 20, 2006 IP
  4. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I was thinking, maybe I'm going about this the wrong way. Instead of trying to change the result from the onClick, maybe I should be asking how it is possible to do this, rather than is it possible a specific way.
     
    egdcltd, Sep 21, 2006 IP
  5. VONRAT

    VONRAT Banned

    Messages:
    181
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    try experimenting with DOM ... :D

    var o = createElement("iframe");
    o.src = "http://whatever";

    then append that to whicever object should have it
     
    VONRAT, Sep 21, 2006 IP
  6. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #6
    What's DOM?
     
    egdcltd, Sep 21, 2006 IP
  7. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hi!

    Google is a wonderful tool. ;)
    http://w3.org/DOM/

    In short, the DOM provides a means for manipulating the page structure through scripting.

    Also, don't use the javascript: pseudo-protocol; use a click handler instead as it provides graceful degradation in JS-incapable environments.
    See this post too.

    Regards
    - P
     
    penagate, Sep 27, 2006 IP