Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/464.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用javascript查找最上层父窗口_Javascript_Jquery - Fatal编程技术网

使用javascript查找最上层父窗口

使用javascript查找最上层父窗口,javascript,jquery,Javascript,Jquery,如果使用了大量框架,如何查找文档的最父主体元素。在几个iframe中的iframe中,我想为最上面的文档体调用一个函数 下面的方法很有效,只是每次你都要计算父母的人数 $(parent.parent.parent.parent.document.body).function('loading'); 难道没有这样的事吗 $(parentOfAllParents.document.body).function('loading'); 这可以从任何iframe:top.window.documen

如果使用了大量框架,如何查找文档的最父主体元素。在几个iframe中的iframe中,我想为最上面的文档体调用一个函数

下面的方法很有效,只是每次你都要计算父母的人数

$(parent.parent.parent.parent.document.body).function('loading');
难道没有这样的事吗

$(parentOfAllParents.document.body).function('loading');

这可以从任何
iframe
top.window.document.body
使用
window.top