title: why this html javascript file doesnt work and how can i make user input to not be anything but positive number?
body: <p>Ive tried few things and none of them works, it doesnt calculate the area, and i want to make user input to be positive number and send error if anything else is written</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
  
  &lt;title&gt; Area of circle &lt;/title&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;script type="text/javascript"&gt;
  &lt;meta charset="UTF-8"&gt;
  
      function CalculateArea(){
      var r = document.form1.txtr.value;
      var area = (r * r * Math.PI);
      document.write("&lt;P&gt; Area is:" + area +"&lt;/P&gt;")
  }
  
  &lt;/script&gt;
  
  &lt;form name=form1&gt;
      Type radient of circle:
      &lt;input type="text" name="txtr" size=10&gt;
      &lt;br&gt;
      &lt;input type="button" value="Calculate" onClick='CalculateArea;'&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>