1. Computing

Distance Calculator with Times

2. Get the Code

clr gif
Join the Discussion

Questions? Comments?

To insert the time/distance calculator into your page the first thing you need to do is to put the following HTML into the body of your page where you want the calculator to appear. (You can modify the text descriptions of the fields if you like).

You also need to add a small piece of HTML into the head of your page that will link the Javascript into the page so that the calculator will function.

<script type="text/javascript" src="dist.js"></script>

Next, copy the following Javascript code and save it in a file called dist.js (which you have just linked into your page. Don't worry about the fact that the cities in the array are not the ones you want - we'll fix that afterwards).

All that remains now is to modify the time/distance array so that it contains the cities you want along with the correct distances and times between them.

Related Video
Zip File 101
Computer Cable Ports 101

©2013 About.com. All rights reserved.