View Full Version : How can I call a JS function of a dynamically created <iframe>?

03-11-2005, 12:47 AM

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?


03-11-2005, 05:36 AM
document.getElementById("Comments" + Code).contentWindow.theFunction();

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum