Update an iframe from a second one when second iframe has submit button pressed?

Discussion in 'JavaScript' started by lateuk, May 29, 2008.

  1. #1
    The title says it all, can anyone help?
     
    lateuk, May 29, 2008 IP
  2. zerxer

    zerxer Peon

    Messages:
    368
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First, you can only do this if each iframe's page is stored on the same domain name as the other and as the page that they're both being framed on.

    Second, you should be able to do this by doing something like..
    parent.document.getElementById('2nd_iframe_id').src = 'new page url';
    Code (markup):
    You'd call that snippet of JavaScript when the person clicks the button in the other iframe. If it doesn't work as I typed it then sorry, I haven't really ever worked with iframes because I don't like them so I'm not sure if doing ".src = 'new url'" will update it immediately, though it should.
     
    zerxer, May 29, 2008 IP
  3. lateuk

    lateuk Active Member

    Messages:
    317
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Great thanks.
     
    lateuk, May 30, 2008 IP