title: How to use captcha in my HTML pop up window
body: <p>I want to use a captcha in my HTML pop up window, I found a simple captcha on the net but how do I write the if-statement to make sure the person can't press the agree button before he has solved the captcha? How do I refer to captcha asp file?</p>
  
  <p>Part of my code I used in HTML:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div style="position:relative; width :100%; height:140px;" &gt;
      &lt;iframe id="captcha" class="ato" src="captcha/test.asp" style="position:relative; width:100%; height:140px;background: linear-gradient(to top, #F9DEB1 0%, #FFFFFF  70%);border-color: #ECD3C4; border-width: 2px; border-style: solid;border-radius:30px;"&gt;&lt;/iframe&gt;    
  &lt;/div&gt;
  </code></pre>
  
  <p>Note: I checked the the <code>if</code>, but how do I refer to Boolean that is in asp file outside of my html file?</p>
  
  <pre><code>ן»¿&lt;%@LANGUAGE="VBSCRIPT"%&gt;
  &lt;%
  Response.CacheControl = "no-cache"
  Response.AddHeader "pragma","no-cache"
  Response.Expires = -1
  %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script type="text/javascript" language="javascript"&gt;
          function RefreshImage(valImageId) {
              var objImage = document.getElementById(valImageId)
              if (objImage == undefined) {
                  return;
              }
              var now = new Date();
              objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form name="form1" id="form1" method="post"&gt;
      &lt;div style="text-align: center; margin-top: 20px;"&gt;
          &lt;%
          if Request.ServerVariables("REQUEST_METHOD") = "POST" and IsEmpty(Request.Form("btnRetry")) then
              Dim lblResult, lblColor
              if IsEmpty(Session("ASPCAPTCHA")) or Trim(Session("ASPCAPTCHA")) = "" then
                  lblResult = "This test has expired."
                  lblColor = "red"
              else
                  Dim TestValue : TestValue = Trim(Request.Form("txtCaptcha"))
                  '//Uppercase fix for turkish charset//
                  TestValue = Replace(TestValue, "i", "I", 1, -1, 1)
                  TestValue = Replace(TestValue, "ִ°", "I", 1, -1, 1)
                  TestValue = Replace(TestValue, "ִ±", "I", 1, -1, 1)
                  '////////////////////
                  TestValue = UCase(TestValue)
  
                  if StrComp(TestValue, Trim(Session("ASPCAPTCHA")), 1) = 0 then
                      lblResult = "CAPTCHA PASSED"
                      lblColor = "green"
  
                  else
                      lblResult = "CAPTCHA FAILED"
                      lblColor = "red"
                  end if
                  '//IMPORTANT: You must remove session value for security after the CAPTCHA test//
                  Session("ASPCAPTCHA") = vbNullString
                  Session.Contents.Remove("ASPCAPTCHA")
                  '////////////////////
              end if
          %&gt;
          &lt;p&gt;&lt;span style="color: &lt;%=lblColor%&gt;; font-weight: bold;"&gt;&lt;%=lblResult%&gt;&lt;/span&gt;&lt;/p&gt;
          &lt;input type="submit" name="btnRetry" id="btnRetry" value="Take another test" /&gt;
          &lt;%else%&gt;
          &lt;img src="captcha.asp" id="imgCaptcha" /&gt;&amp;nbsp;&lt;a href="javascript:void(0);" onclick="RefreshImage('imgCaptcha');"&gt;Get a new challenge&lt;/a&gt;&lt;br /&gt;
          Write the characters in the image above&lt;br /&gt;
          &lt;input type="text" name="txtCaptcha" id="txtCaptcha" value="" /&gt;&lt;br /&gt;
          &lt;input type="submit" name="btnSubmit" id="btnSubmit" value="Submit" /&gt;
          &lt;%end if%&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>