title: Calling a javascript function in iFrame opened with Fancybox popup
body: <p>I'm trying to call a javascript function in a page opened in an iFrame using jQuery Fancybox. </p>
  
  <pre><code>            $(".testbox").fancybox({
                  maxWidth    : 800,
                  maxHeight   : 600,
                  fitToView   : false,
                  autoSize    : false,
                  closeClick  : false,
                  openEffect  : 'none',
                  closeEffect : 'none',
                  afterShow: function() {
                          //var frameID = $('#fancybox-frame')
                          //frameID.getParam("test");                         
                      }
              }); 
  
          $(".testbox").each(function() {
                  var element = this;
                  $(this).fancybox({
                      'titleFormat'   : function() {
                          var astring = '&lt;span&gt;' + element.id + '&lt;/span&gt;';
                          alert(astring);
                      }
                  });
              });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>    &lt;a class="testbox fancybox.iframe" href="include/testFrame.html"&gt;Iframe&lt;/a&gt;
  </code></pre>
  
  <p>The function in the testFrame.html I'm trying to call:</p>
  
  <pre><code>        function getParam(param) {              
              alert(param);               
          }
  </code></pre>
  
  <p>Normally I'd do this when calling functions in iFrame without using a Fancybox popup:</p>
  
  <pre><code>        document.getElementById('myFrame').contentWindow.getParam();
  </code></pre>
  
  <p>but I don't know how to get the ID of the whole iFrame when using Fancybox. Any help is appreciated!</p>
  
  <p><strong>Edit:</strong> 
  I also tried this code which also didn't work, I get the error in IE: Object doesn't support this property or method. I've made sure the page I'm loading has the function</p>
  
  <pre><code>    var $f = $("#fancybox-frame");
      var fd = $f[0].document || $f[0].contentWindow.document; 
      fd.getparam("test");  
  </code></pre>