title: Check for a specific character string using javascript
body: <p>How can I write ad check for a specific character string in a text field? </p>
  
  <p>If someone types in this identification number in a textfield. <br> Upon submit, it will look if it starts with "D" 
  IE: D959344843 </p>
  
  <p>If it does, display a DIV on the page. If not, prompt an error alert message.</p>
  
  <p>-=-=-=-=-=-=-=-=-=-=-=--= <br>
  New addition <br>
  How can I code this on my page and make it work?</p>
  
  <p><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</code>
  <br /><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</code>
  <br /><code>&lt;head&gt;</code>
  <br /><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;</code>
  <br /><code>&lt;title&gt;Test&lt;/title&gt;</code></p>
  
  <p><br /><code>&lt;script type="text/javascript"&gt;</code>
  <br /><code>var mystring = 'D59344843';</code></p>
  
  <p><br /><code>if(mystring.substring(0, 1) == 'D'){</code>
     <br /><code>//display a DIV</code>
    <br /><code>alert('cool');</code>
  <br /><code>}else{</code>
     <br /><code>alert('error is no kewl');</code>
  <br /><code>}</code>
  <br /><code>&lt;/script&gt;</code></p>
  
  <p><br /><code>&lt;/head&gt;</code></p>
  
  <p><br /><code>&lt;body&gt;</code>
  <br /><code>&lt;input name="yourtextfield" value="" type="text" /&gt;</code>
  <br /><code>&lt;input name="" type="submit" /&gt;</code>
  <br /><code>&lt;/body&gt;</code>
  <br /><code>&lt;/html&gt;</code></p>