title: How to pass argument if event handler is assigned in initialization function?
body: <p>It is always good to separate presentation layer and behaviour between HTML and Javascript based on head first book.</p>
  
  <p>They tell me not to do:</p>
  
  <pre><code>&lt;textarea onclick="showAlert()"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>But instead, do below:</p>
  
  <p>The example below separate the behaviour from HTML code (structure).</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;script type="text/javascript"&gt;
  window.onload = init;
  
  function init() {
    $('txt_area').onclick = showAlert;
  }
  
  function showAlert(say) {
    alert(say);
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;textarea id="txt_area"&gt;&lt;/textarea&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This allows HTML (structure) to look clean and "behaviour" part is initialized in init() function when page loads. I understand that so far.</p>
  
  <p>But then I wonder how am I supposed to pass an argument to showAlert() function???</p>
  
  <p>Below does not work, it will call the showAlert() as soon as the page loads and this is not what I want to because it needs to be fired onclick.</p>
  
  <pre><code>function init() {
    $('txt_area').onclick = showAlert("hello");
  }
  </code></pre>
  
  <p>Is it possible to pass arguments to showAlert() function but still separate the behaviour and structure?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Forgot to mention.. I'm using prototype.</p>