Posted By

alexscript on 06/25/11


iframe window function document call Parent

Versions (?)

Call IFrame Javascript function from parent document/window

 / Published in: JavaScript

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

  1. var iframe = document.getElementById("myframe");
  2. if (iframe) {
  3. var iframeContent = (iframe.contentWindow || iframe.contentDocument);
  5. iframeContent.targetFunction();
  6. }

Report this snippet  

You need to login to post a comment.