Return to Snippet

Revision: 48161
at June 25, 2011 07:05 by alexscript


Updated Code
var iframe = document.getElementById("myframe");
if (iframe) {
   var iframeContent = (iframe.contentWindow || iframe.contentDocument);

   iframeContent.targetFunction();
}

Revision: 48160
at June 25, 2011 05:48 by alexscript


Initial Code
var iframe = document.getElementById("myframe");
if (iframe) {
   var iframeContent = (iframe.contentWindow || iframe.contentDocument);
   if (iframeContent.document) { 
      iframeContent = iframeContent.document;
   }

   iframeContent.targetFunction();
}

Initial URL

                                

Initial Description
This snippet lets you call a Javascript function declared within an IFrame from the parent element of the IFrame

Initial Title
Call IFrame Javascript function from parent document/window

Initial Tags
window, function

Initial Language
JavaScript