Event handlers in separate document
<p>I got this HTML:</p>

<pre><code>&lt;a href="http://www.commercial.com" onclick="confirmLeave()" target="_blank"&gt; 
</code></pre>

<p>and</p>

<pre><code>&lt;IMG SRC="folder/picture_small.jpg" alt="Desrciption" onClick="view(this);"&gt;
</code></pre>

<p>And then I got a seperate Javascript document connected to this with this JS code:</p>

<pre><code>  function confirmLeave()
  {
     if(confirm("Do you want to leave my page??")) {
      return true;
    } else {
      if(window.event) {
        window.event.returnValue = false;
      } else {
        e.preventDefault();
      }
      return false;
    }
  }
</code></pre>

<p>and </p>

<pre><code>function view(img) {
   imgsrc = img.src.split("_")[0] + "_big.jpg";
   viewwin = window.open(imgsrc,'viewwin', "width=790,height=444,location=0");  
  viewwin.focus();  
}
</code></pre>

<p>I would like to move my event handlers into my javascript document as well so I don't need the onClick command in my HTML. How do I do this?</p>
