1. Home
  2. Computing & Technology
  3. JavaScript

Distance Calculator with Times

1. Introduction and Sample

clr gif
Join the Discussion

Questions? Comments?

This variant of my distance calculator not only displays the distances between each of your selected cities/locations, it also displays the expected travel time between those locations as well.

The following example displays the distances and times between a few places near Oklahoma City but the script can be easily adapted to work with any locations simply by entering the names of the locations and the distance and times between them into a multi-dimensional array. The script simply requires starting and destination cities to be selected and the distance and time between them will be extracted from the array and displayed.

Starting City:
Destination City:
Distance: Miles
Travel Time: Minutes

If you want to add a copy of this time/distance calculator to your site then the first thing you need to do is to get the HTML and Javascript.

Explore JavaScript
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.