title: javascript syntax: function calls and using parenthesis
body: <p>why does this work..</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!-- 
  
  function myAlert(){
      alert('magic!!!');
  }
  
  
  if(document.addEventListener){   
      myForm.addEventListener('submit',myAlert,false); 
  }else{   
      myForm.attachEvent('onsubmit',myAlert); 
  }
  // --&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>but not this ????</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!-- 
  
  function myAlert(){
      alert('magic!!!');
  }
  
  
  if(document.addEventListener){   
      myForm.addEventListener('submit',myAlert(),false); 
  }else{   
      myForm.attachEvent('onsubmit',myAlert()); 
  }
  // --&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>the difference being the use of parenthesis when calling the <code>myAlert</code> function.</p>
  
  <p>the error I get.. </p>
  
  <blockquote>
    <p>"htmlfile: Type mismatch." when compiling via VS2008.</p>
  </blockquote>