title: Onclick vs Onsubmit issues (True/false and alert behaviors?)
body: <p>Long story short, I'm trying to understand how to utilize onsubmit correctly. The testresults function works fine with onclick, but I can't get it to active on submit (with a button, or hitting enter). Am I missing something here? Ultimately, I just want onsubmit to run a check and give the same sorts of border change/alert as onclick would. Is this not possible?</p>
  
  <pre><code>function testResults(form) {
      var TestVar = form.firstname.value;
      if (TestVar.length &gt; 0) {
          alert("You typed: " + TestVar);
          document.getElementById('firstname').style.border = ''
      } else {
          alert("You didn't typed!" + TestVar);
          document.getElementById('firstname').style.border = '1px solid red';
          return false;
      }
      return true;
  }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;html&gt;    
  &lt;head&gt;
      &lt;link rel="stylesheet" type="text/css" href="note.css"&gt;
      &lt;script type="text/javascript" src="formJS2.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form NAME="myform" ACTION="" METHOD="GET" onSubmit="testResults();"&gt; &lt;span&gt;First name:&lt;/span&gt; 
          &lt;input type="text" name="firstname" id="firstname" value="" /&gt;
          &lt;br&gt;
          &lt;input type="submit" value="Submit"&gt;
          &lt;input type="button" name="button" value="Click" onClick="testResults(this.form)"&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>