APC Houses Javascript code snippet

From Ingmar de Boer
Revision as of 00:06, 9 April 2016 by Ingmardb (Talk | contribs) (Created page with "<SCRIPT LANGUAGE="JavaScript"> <!-- hide this script tag's contents from old browsers function compute(form) { PH=(form.nPh.value=="")? "0" : eval(form.nPh.value); ECL=(...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<SCRIPT LANGUAGE="JavaScript"> function sector(n, ph, ecl, az) {

 var dasc, kv, a;
 
 kv   = ATan(Tan(ph) * Tan(ecl) * Cos(az)/(1 + Tan(ph) * Tan(ecl) * Sin(az)));
 dasc = ATan(Sin(kv) / Tan(ph));
 
 if (n<8) {a = kv + az + pi/2 + (n -  1) * (pi/2 - kv) / 3;}
 else     {a = kv + az + pi/2 + (n - 13) * (pi/2 + kv) / 3;}
 
 return gra(ATan2(Tan(dasc) * Tan(ph) * Sin(az) + Sin(a),
   Cos(ecl) * (Tan(dasc) * Tan(ph) * Cos(az) + Cos(a)) + Sin(ecl) * Tan(ph) * Sin(az - a)));

}

// done hiding from old browsers --> </SCRIPT> </HEAD>

<BODY onLoad="exampledata(); compute(document.form);">


<FORM NAME="form">

    Enter the appropriate values here

     G.Lat  <INPUT TYPE="text" NAME="nPh"       SIZE=20>        <INPUT TYPE="button" VALUE="  Reset form  " OnClick="resetform(this.form)">
     E      <INPUT TYPE="text" NAME="ne"     SIZE=20>        <INPUT TYPE="button" VALUE=" Example data " OnClick="exampledata(this.form); compute(this.form);">
     ARMC   <INPUT TYPE="text" NAME="naz"      SIZE=20>        <INPUT TYPE="button" VALUE="   Calculate  " OnClick="compute(this.form)">

    APC Cusps

     1      <INPUT TYPE="text" NAME="cusp1"      SIZE=20>   7    <INPUT TYPE="text" NAME="cusp7"      SIZE=20>
     2      <INPUT TYPE="text" NAME="cusp2"      SIZE=20>   8    <INPUT TYPE="text" NAME="cusp8"      SIZE=20>
     3      <INPUT TYPE="text" NAME="cusp3"      SIZE=20>   9    <INPUT TYPE="text" NAME="cusp9"      SIZE=20>
     4      <INPUT TYPE="text" NAME="cusp4"      SIZE=20>   10   <INPUT TYPE="text" NAME="cusp10"      SIZE=20>
     5      <INPUT TYPE="text" NAME="cusp5"      SIZE=20>   11   <INPUT TYPE="text" NAME="cusp11"      SIZE=20>
     6      <INPUT TYPE="text" NAME="cusp6"      SIZE=20>   12   <INPUT TYPE="text" NAME="cusp12"      SIZE=20>