Distance Calculator
Friday June 19, 2009
How far is it between two places? Make your own JavaScript calculator to display the distances between your choice of locations.
This JavaScript "calculator" will allow visitors to your site to obtain the distance between two cities (or other locations) by selecting the start and end points for their journey from two drop down lists. You can set up whatever locations that you like for the "calculator" simply by setting up the places and distances between them in the array structure at the top of the JavaScript.
Distance Calculator


You say copy and paste in a file called
dist.js . How do I gain access or create such a file. I tried everything I know to place the Distance Calculator on my page but get stuck at this last instruction, which is to copy and paste in the dist.js file.
1. Open your favourite plain text editor – perhaps notepad if you are using Windows or vi or emacs on Linux.
2. Copy the content for the dist.js file from the page and paste it into the empty page in the editor.
3. Save the file with the name dist.js
4. Upload the file to the folder on your site where you uploaded the page that refers to it.