title: Getting HTML form values
body: <p>How can I get the value of an HTML form to pass to JavaScript?</p>
  
  <p>Is this correct? My script takes two arguments one from textbox, one from the dropdown box.</p>
  
  <pre><code>&lt;body&gt;
  &lt;form name="valform" action="" method="POST"&gt;
  
  Credit Card Validation: &lt;input type="text" id="cctextboxid" name="cctextbox"&gt;&lt;br/&gt;
  Card Type: &lt;select name="cardtype" id="cardtypeid"&gt;
    &lt;option value="visa"&gt;Visa&lt;/option&gt;
    &lt;option value="mastercard"&gt;MasterCard&lt;/option&gt;
    &lt;option value="discover"&gt;Discover&lt;/option&gt;
    &lt;option value="amex"&gt;Amex&lt;/option&gt;
    &lt;option value="diners"&gt;Diners Club&lt;/option&gt;
  &lt;/select&gt;&lt;br/&gt;
  &lt;input type="button" name="submit" value="Verify Credit Card" onclick="isValidCreditCard(document.getElementById('cctextboxid').value,document.getElementById('cardtypeid').value)" /&gt;
  &lt;/body&gt;
  </code></pre>