Advertisement
Advertisement
| 07.08.2008 at 05:31PM PDT, ID: 23548760 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link href="/style.css" rel="stylesheet" type="text/css" />
<title>Miles to ... using Maps API</title>
<script type="text/javascript" src="http://www.google.com/jsapi?key=[your Google API Key]"></script>
<script type="text/javascript">
//<![CDATA[
google.load("maps", "2");
var gdir;
function load() {
if (GBrowserIsCompatible()) {
gdir = new google.maps.Directions();
google.maps.Event.addListener(gdir, "load", handleLoad);
gdir.load("from: Washington, DC to: Pittsburgh, PA", {getSteps: true});
}
}
function handleLoad() {
document.getElementById("totalMiles").innerHTML = gdir.getDistance().html;
}
window.onload = load;
window.onunload = google.maps.Unload;
//]]>
</script>
</head>
<body>
<h3>Miles to ... </h3>
<div id="totalMiles"></div>
</body>
</html>
|