Modified from a free JavaScript provided
JavaScript Seismology Functions:
This is a calculator that you can program by pasting in JavaScript language formulas in the top text space. You can use the keyboard to paste in simple formulas; or you can compose a multi-line function in Javascript, save it in a text file, an paste it in. The calculator uses the "eval" function to solve the equations. Use semicolons to separate the lines of a multiline function. After entering the function and clicking on "Go", a number will appear on the third text space. The values for all variables can be displayed by entering the variable name on the top line, and clicking on "Go".
The second text space serves only as a scratch storage space for whatever text you might want to enter by the usual text editing methods, or by clicking on "sav" or "txt". The text of this file contains the line "var x,y,z,a,b,c,i,j". To set up other names of variables or arrays, just modify this line, using NotePad and save. For further reading:
by The JavaScript Source
abs Absolute value sin, cos, tan Standard trigonometric functions; argument in radians acos, asin, atan, atan2 Inverse trigonometric functions; return values in radians exp, log Exponential and natural logarithm, base e ceil Returns least integer greater than or equal to argument floor Returns greatest integer less than or equal to argument min, max Returns greater or lesser (respectively) of two arguments pow Exponential; first argument is base, second is exponent random Returns a random number between 0 and 1. round Rounds argument to nearest integer sqrt Square root
dist Enter S minus P time, press "Go" for
distance in degrees SP Enter distance in degrees; press "Go"
for S minus P in seconds
E Euler's constant and the base of natural logarithms, approximately 2.718. LN2 Natural logarithm of 2, approximately 0.693 LN10 Natural logarithm of 10, approximately 2.302. LOG2E Base 2 logarithm of E (approximately 1.442). LOG10E Base 10 logarithm of E (approximately 0.434). PI Ratio of the circumference of a circle to its diameter, approximately 3.14159 SQRT1_2 Square root of 1/2; approximately 0.707. SQRT2 Square root of 2, approximately 1.414.
http://javascript.internet.com/tutorials/
http://javascript.internet.com/tutorials/CoreGuideJS15.zip
http://javascript.internet.com/tutorials/CoreReferenceJS15.zip
http://www.webreference.com/programming/javascript/diaries/1/