SitePoint Sponsor

# Thread: Creating a HTML / Javascript calculator or form for my website

1. ## Creating a HTML / Javascript calculator or form for my website

Help!
I am in the progress of creating a website using a drag and drop sitebuilder because I am an absolute novice, I have played around with a bit of HTML but find myself in too deep if I am honest. Anyway, over the last 4 or 5 days I have been trying and trying to create an online form/calculator based on an excell spreadsheet i have created.

The idea is that users input co-ordinates (Eastings and Northings) of 2 points and the form generates the distance and the bearing from point 1 to point 2. I also want a form to do the reverse, the user inputs the cooordinates of point 1 as well as a distance and bearing and the form generates point 2. This is simple trigonometry and I have a spreadsheet with the formulas on (see below) but i cannot for the life of me make the plainest of forms that will calculate this on a webpage.
I would be so grateful if someone could help me with this, even posting a simple form may aid me in breaking it down and creating similar forms in the future. The excell formulas are shown below:

User Inputs:
E1
N1
E2
N2

Form Generates:
D = ( (E1-E2)^2 + (N1-N2)^2 )^0.5
Basically Pythagoras' Theorem

B = MOD (DEGREES(ATAN2( (E2-E1),(N2-N1) )),360)

If the form did work two ways so users can input either 2xco-ords or 1xco-ords and distance and bearing that would be great too but to be honest I just need some help to avoid more sleepless nights!

Thank you all.

2. Sorry all, the bearing should be B = MOD (DEGREES(ATAN2( (N2-N1),(E2-E1) )),360)

thanks again

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•