Untitled


SUBMITTED BY: Guest

DATE: Nov. 13, 2013, 10:57 a.m.

FORMAT: Text only

SIZE: 392 Bytes

HITS: 6207

  1. function computeTotalDistance(result) {
  2. var total = 0;
  3. var myroute = result.routes[0];
  4. for (i = 0; i < myroute.legs.length; i++) {
  5. total += myroute.legs[i].distance.value;
  6. }
  7. total = total / 1000.
  8. document.getElementById("total").innerHTML = total + " km";
  9. }
  10. var metric = myroute.legs[0].distance.text.indexOf(" km")!= -1?true:false;

comments powered by Disqus