Is it possible to cancel body onunload action after the page is loaded?
<p>So I have a page that has the following in its body tag:</p>

<p>In the iframe...</p>

<pre><code>&lt;body onunload="parent.foobar();"&gt;
</code></pre>

<p>...</p>

<p>Is it possible that later in the page, I build a click function like this:</p>

<pre><code>&lt;a href="#" onclick="NoFooBar();"&gt; Do not run foobar if this page is unloaded &lt;/a&gt;

&lt;script&gt;
</code></pre>

<p>In the parent page...</p>

<pre><code>function NoFooBar()
{
$("#ifrm").contents().find('body').removeAttr("onunload");
}

&lt;/script&gt;
</code></pre>

<p>This doesn't seem to work? Is it possible to later change the body attribute and expect it to act accordingly? Or it has been cached and will always following the initial settings?</p>

<p>And is there anyway to achieve what I expected to happen in some other way?</p>

<p>Thanks</p>
