title: Getting text from HTML form and pass to JavaScript function
body: <p>I am learning HTML/JavaScript and am writing a simple site to test what I've learned so far.
  I am trying to get the firstname and lastname entered by the user from an input form and then pass these names to a JavaScript function but for some reason, all I see in my popup window is: </p>
  
  <blockquote>
    <p>Hello [object HTMLInputElement]</p>
  </blockquote>
  
  <p>This is my html code:</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Daynesh's Test Site&lt;/title&gt;
      &lt;script&gt;
          function addUser(first, last)
          {
          alert("Hello " + first);
          }
      &lt;/script&gt;
      &lt;/head&gt; 
      &lt;body&gt;
      &lt;h1&gt;Registered Users&lt;/h1&gt;
      &lt;p&gt;Enter user name:&lt;/p&gt;
      &lt;form&gt;First name: &lt;input type="text" name="firstname"&gt;
        Last name: &lt;input type="text" name="lastname"&gt;
          &lt;input type="submit" value="Submit" onclick="addUser(firstname,'right')"&gt;
      &lt;/form&gt;
      &lt;hr&gt;
      &lt;h3&gt;Output&lt;/h3&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Can someone please explain what I'm doing wrong?  I'm sure its something very simple that I'm not understanding here.</p>
  
  <p>Thanks in advance!</p>