IFRAMEs, .contentWindow, .contentDocument区别

from: http://www.omnigroup.com/mailman/archive/omniweb-l/2003/015196.html

> I'm working on a web site that uses inline frames (iframes), with the
> following code to interact with javascripts in the frame:
>
> panelFrame=document.getElementById('panelFrame');
> panelFrame.contentWindow.somefunction();
>
> Now, OmniWeb and Safari both fail on this while Mozilla and IE both
> work. I did some checking, and it turns out that IFRAME.contentWindow
> is not part of the DOM2 spec. Both OmniWeb and Safari support the
> DOM-standard .contentDocument property, which refers to the document
> object of that frame. Javascript global variables and functions,
> however, are stored on the window object, not the document object,
> hence the .contentWindow property that's supported by Mozilla and IE.

你可能感兴趣的:(IFRAMEs, .contentWindow, .contentDocument区别)