title: validate textbox entry 3 digit numbers separated by commas
body: <p>I have a textbox on a registration forms that collects telephone area codes - my smart self didn't think my customers would be so great to enter 5 digit zip codes instead of 3 digit area codes, so now I need to make a make a jquery or javascript function to validate the entry is in ###,###,###,###,###... format there is no limit to the number of area codes they can enter.
  problem is I have no idea how the code should go - any ideas
  my text box</p>
  
  <pre><code>&lt;input type="text" id="acode" name="acode" /&gt;
  </code></pre>
  
  <p>I appreciate it</p>
  
  <p><em><strong>Completed code</em></strong></p>
  
  <p>HTML</p>
  
  <pre><code>  &lt;label for="acode"&gt;Enter area codes separated by commas (757,804,252,###):&lt;/label&gt;
    &lt;input type="text" id="acode" name="acode" onblur="valarea(this.form)"/&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>&lt;script&gt;
  function valarea(form)
  {
  inputvalue =form.acode.value;
  var regexp = /^\d{3}(?:,\d{3})*$/;
  if (inputvalue != "")
  {
  if (regexp.test(inputvalue)) {
  //nothing happens
  } else {
  alert('You have entered an invalid value, you should have listed 3 digit telephone area codes for the areas you are interested in shopping separated by commas (757,804,252,###) Please Correct the problem before continuing')
  form.acode.focus()
  }
  }
  }
  </code></pre>