Calling a function in an iframe from a parent in firefox
I'm trying to call a function, test(), of an iframe from the parent document using the code
subframe.test();
subframe refers correctly to the iframe, alert(subframe) returns [object HTMLIFrameElement], and the function runs in both IE7 and opera (9.23), but not firefox (3.0), chrome (3.0) or safari (3.03 beta windows). I assume these browsers support the funct开发者_如何学编程ionality, so wondering if perhaps I'm using an incorrect call which IE and Opera support anyway, which wouldn't surprise me.
Thought I should answer for posterity - I solved the problem using subframe.contentWindow.test() .
Is the domain of the parent document's source the same as that of the child iframe's? I believe FireFox requires that they are in order to do something like this.
精彩评论