Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How can I call a JS function of a dynamically created <iframe>?

    Hello,

    I have the following problem:

    inside a JS function I have following code:

    var e = document.getElementById("CommentsiFrameSpan" + Code)
    e.innerHTML="<IFRAME src=\"" + url + "\" name=\"Comments" + Code + "\" id=\"Comments" + Code + "\"></IFRAME>";




    Code and url are variables that are passed to the function.
    after creating the frame, I want to set the parent of the dynamically created frame and call JS function inside the frame. How do I do that?


    Thanks,
    Avi

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    document.getElementById("Comments" + Code).contentWindow.theFunction();
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •