title: Dynamic event-function binding isn't happening in vbscript / javascript
body: <p>Button 1 works fine, but when I try to insert button 2 dynamically the onclick event doesn't call its mapped function, any clue how it works? This is a simple example but later I need to capture events from complex object like trackbar's scroll event.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;a simple first page&lt;/title&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          $("#form").append("&lt;input id='button2' type='button' value='button 2'&gt;");
      });
  &lt;/script&gt;
  &lt;script language="vbscript"&gt;
  Sub Button1_OnClick()
          MsgBox "button 1"
  End Sub
  
  Sub Button2_OnClick()
          MsgBox "button 2"
  End Sub
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id="form"&gt;&lt;input id="button1" type="button"
      value="button 1"&gt;&lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>