title: How to validate the verification code in javascript?
body: <p>I am creating a form with verification code.
  The verification code is an image, right?(Let me know, if i am wrong.)
  How to know that the user is entering correct verification code. (That means how to validate the verification code in javascript, even need to check user is entering the correct case.) or may be in servlet is also fine.
  Here, is my code in html page.</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;
  &lt;script type="text/javascript"&gt; 
  function ValidateForm(frm) {
  if (frm.CaptchaCode.value == "") {alert('Enter web form code.');frm.CaptchaCode.focus();return false;}  
  return false;
  }
  function ReloadCaptchaImage(captchaImageId) {
  var obj = document.getElementById(captchaImageId);
  var src = obj.src;
  var date = new Date();
  var pos = src.indexOf('&amp;rad=');
  if (pos &gt;= 0) { src = src.substr(0, pos); }
  obj.src = src + '&amp;rad=' + date.getTime();
  return false; }
  &lt;/script&gt;
  &lt;i&gt;Enter web form code*:&lt;/i&gt;
  &lt;input id="CaptchaCode" name="CaptchaCode" type="text" style="width:80px; border:1px solid #999999;" maxlength="6" /&gt;
  &lt;a href="http://www.SnapHost.com"&gt;&lt;img id="CaptchaImage" alt="Web Form Code" title="Anti-spam web forms"
  style="margin-left:20px; border:1px solid #999999"
  src="http://www.SnapHost.com/captcha/WebForm.aspx?id=HQWK4M77B9KH&amp;ImgType=2" /&gt;&lt;/a&gt;
  &lt;br /&gt;&lt;a href="#" onclick="return ReloadCaptchaImage('CaptchaImage');"&gt;
  &lt;span style="font-size:12px;"&gt;reload image&lt;/span&gt;&lt;/a&gt;
  &lt;/body&gt;&lt;/html&gt; 
  </code></pre>