topical media & game development

talk show tell print

lib-js-math-calculator-triangle.js / js



  /* This script and many more are available free online at
  The JavaScript Source!! http://javascript.internet.com
  Created by: Sandeep Gangadharan | http://sivamdesign.com/scripts/ */
  function getProp() {
    var A = document.prop.A.value;
    var B = document.prop.B.value;
    var C = document.prop.C.value;
    var S = (parseInt(A) + parseInt(B) + parseInt(C)) / 2;
    var Z = parseInt((A*A)+(B*B)-(C*C))/parseInt(2*A*B);
  
    document.prop.area.value = Math.round(Math.sqrt(S*(S-A)*(S-B)*(S-C)) * 10000) / 10000;
    document.prop.lic.value = Math.round(Math.PI * (document.prop.area.value/S) * (document.prop.area.value/S) * 10000) / 10000;
    document.prop.sic.value = Math.round(Math.PI * ((A*B*C)/(4*(document.prop.area.value))) * ((A*B*C)/(4*(document.prop.area.value))) * 10000) / 10000;
    document.prop.ang.value = Math.round(Math.atan(Math.sqrt((1/(Z * Z))-1)) * (180/Math.PI) * 10000) / 10000;
  }
  
  


(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.