日期:2014-05-17 浏览次数:20432 次
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript">
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
var geocoder;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
geocoder = new google.maps.Geocoder();
var chicago = new google.maps.LatLng(41.850033, -87.6500523);
var myOptions = {
zoom: 7,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
center: chicago
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById("directionsPanel"));
var tmpArr, QueryString;
var URL = document.location.toString();
if (URL.lastIndexOf("?") != -1) {
QueryString = URL.substring(URL.lastIndexOf("?") + 1, URL.length);
QueryString = QueryString.substring(QueryString.lastIndexOf("=") + 1, QueryString.length);
tmpArr = QueryString.split("&");
for (i = 0; i < tmpArr.length; i++) {
try {
var ID = eval(tmpArr[i]);
}
catch (e) {
var re = new RegExp("(.*)=(.*)", "ig");
re.exec(tmpArr[i]);
try { eval(RegExp.$1 + "=" + "\"" + RegExp.$2 + "\""); }
catch (e) { }
}
}
}
else {
QueryString = "";
}
if (QueryString.length > 0) {
document.getElementById("addressIfnfo").value = QueryString;
$(document).ready(function() {
codeAddress();
});
}
}
function calcRoute() {
var start = document.getElementById("fromAddress").value;
var end = document.getElementById("toAddress").value;
var request = {
origin: start,
destination: end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {