title: Failed to set event handler in javascript
body: <p>I want to add an event handler for input text controls. The controls is generated dynamically. My code is like:</p>
  
  <p><strong>JavaScript</strong>:</p>
  
  <pre><code>var settings_check = new Array("checkVMName()","checkDiskMB()","checkMemMB()","checkEsx()","checkDatastore()");
  ...
  _inputbox = document.createElement("input");
  _inputbox.type = "text";
  _inputbox.id = settings[zindex];
  _inputbox.onblur = settings_check[zindex];
  
  _hint = document.createElement("hint");
  _hint.id = settings[zindex] + "_Label2";
  _hint.innerText = settings_hint[zindex];
  
  mycurrent_cel2.appendChild(_inputbox);
  mycurrent_cel2.appendChild(_hint);
  </code></pre>
  
  <p>But this way doesn't work. I checked the HTML with Firebug, and no "onblur" attribute for the input text control at all. </p>
  
  <p><strong>HTML</strong></p>
  
  <blockquote>
  <pre><code>&lt;tr&gt;
    &lt;td&gt;....&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" id="Datastore"&gt;
        &lt;hint id="Datastore_Label2"&gt;start with /&lt;/hint&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  </blockquote>
  
  <p>I also tried other ways to set event handler like</p>
  
  <pre><code>_inputbox.onblur = function(){alert("test");};
  </code></pre>
  
  <p>or</p>
  
  <pre><code>_inputbox.setAttribute("onblur",func);
  </code></pre>
  
  <p>Neither works. :(</p>
  
  <p>If I manually add onblur=function(){...} for the input text control in the HTML with Firebug and execute, the onblur does work. So the question is: how can I set event handler for a control in JavaScript? Is there anything wrong in my code? Thanks.</p>