error with onunload event
<p>I've got a problem with the <code>onunload</code> event testing script
it must fire only on the window <code>onunload</code>
but it fires with load as well.. Why?
There is something wrong, and I don't know what it is..
Please help</p>

<p>Here is the html code</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;script type="text/javascript"&gt;
function hello(){alert("welcome to my page");}
&lt;/script&gt;
&lt;script type="application/javascript" src="script.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="hello()" &gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>and here's the script code</p>

<pre><code>window.onunload = goodbye();
function goodbye(){
alert("Thank you for visiting.come back soon!");
}
//window.addEventListener('unload',goodbye(),false);
</code></pre>

<p>I've tried the inline calling with body tag, the <code>window.onunload</code> calling and the listener calling.
Nothing works correctly, and I get the "Thank you for visiting. come back soon!" message when the page first loads.</p>
