topical media & game development

talk show tell print

lib-js-math-calculator-circle.htm / htm



  
  <!-- TWO STEPS TO INSTALL CIRCLE SOLVER:
  
    1.  Copy the coding into the HEAD of your HTML document
    2.  Add the last code into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
  
  <HEAD>
  
  <SCRIPT LANGUAGE="JavaScript">
  <!-- Original:  Chris Brown  -->
  <!-- Web Site:  http://www.geocities.com/BourbonStreet/3843  -->
  
  <!-- This script and many more are available free online at -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Begin
  function circle(form,changed) {
  with (Math) {
  var area = form.area.value;
  var diameter = form.diameter.value;
  var circumference = form.circumference.value;
  if (changed == "area") {
  var radius = sqrt(area / PI);
  diameter = 2 * radius;
  circumference = PI * diameter;
  }
  if (changed == "diameter") {
  area = PI * (diameter / 2) * (diameter / 2);
  circumference = PI * diameter;
  }
  if (changed == "circumference") {
  diameter = circumference / PI;
  area = PI * (diameter / 2) * (diameter / 2);
         }
  form.area.value = area;
  form.diameter.value = diameter;
  form.circumference.value = circumference;
    }
  }
  var toDegrees = 360 / (Math.PI * 2);
  var toRadians = (Math.PI * 2) / 360;
  //  End -->
  </script>
  </HEAD>
  
  <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
  
  <BODY>
  
  <center>
  <form method=post>
  <table border="5">
  <tr>
  <td align=center>Area:</td>
  <td align=center><input type=text name=area size=6 value=0  onFocus="select()"></td>
  <td align=center><input type=button value="Solve Others" onClick="circle(this.form,'area')"></td>
  </tr>
  <tr>
  <td align=center>Diameter:</td>
  <td align=center><input type=text name=diameter size=6 value=0 onFocus="select()"></td>
  <td align=center><input type=button value="Solve Others" onClick="circle(this.form,'diameter')"></td>
  </tr>
  <tr>
  <td align=center>Circumference:</td>
  <td align=center><input type=text name=circumference size=6 value=0 onFocus="select()"></td>
  <td align=center><input type=button value="Solve Others" onClick="circle(this.form,'circumference')"></td>
  </tr>
  </table> 
  </form>
  </center>
  
  <p><center>
  <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
  by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  </center><p>
  
  <!-- Script Size:  2.12 KB -->
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.