Call a function from an iframe...

Discussion in 'JavaScript' started by redhits, Nov 9, 2009.

  1. #1
    I have an default.html file, containing some functions...
    and a preview.php that i am loading into an iframe..
    my question is: can i call a default.html javascript function from inside the iframe?!
     
    redhits, Nov 9, 2009 IP
  2. liss

    liss Active Member

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #2
    yes you can if same domain for iframe
    window.parent.NAMEOFFUNCTION
     
    liss, Nov 10, 2009 IP
  3. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #3
    Yeah i already found it.

    You need to use parent.function() only:)
     
    redhits, Nov 10, 2009 IP