2012-06-26 28 views

回答

3
if (node.ownerDocument.defaultView.frameElement)   
    // We're inside of an <iframe> 

Explantions到的代码:

node.ownerDocument.defaultView.frameElement 
// ^------------------------------------------ The document of the <iframe>. 
//    ^--------------------------- The window of the <iframe> 
//        ^---------------- The <iframe>