Find most upper parent window with javascript
<p>How to find the most parent body element of a document, if you're using a lot of frames. Inside a iframe that also is in a few iframes, I want to call a function for the most upper document body.</p>

<p>The following works, except that you have to count for the parents each time.</p>

<pre><code>$(parent.parent.parent.parent.document.body).function('loading');
</code></pre>

<p>Isn't there something like this?;</p>

<pre><code>$(parentOfAllParents.document.body).function('loading');
</code></pre>
