Google maps 在我的谷歌地图代码中,我可以在哪里向方向添加旅行模式?
我有我的自定义地图工作的方向。然而,我希望添加我在谷歌开发者网站上发现的下拉列表,它允许选择“自行车”、“驾驶”、“交通”、“步行”Google maps 在我的谷歌地图代码中,我可以在哪里向方向添加旅行模式?,google-maps,mode,directions,Google Maps,Mode,Directions,我有我的自定义地图工作的方向。然而,我希望添加我在谷歌开发者网站上发现的下拉列表,它允许选择“自行车”、“驾驶”、“交通”、“步行” 这是我调用函数的代码,我不知道它们在哪里: var map; var gdir; var geocoder = null; var addressMarker; function initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElemen
这是我调用函数的代码,我不知道它们在哪里:
var map;
var gdir;
var geocoder = null;
var addressMarker;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
gdir = new GDirections(map, document.getElementById("directions"));
GEvent.addListener(gdir, "load", onGDirectionsLoad);
GEvent.addListener(gdir, "error", handleErrors);
setDirections(document.getElementById("fromAddress").value, document.getElementById("toAddress").value, "en_US");
}
}
function setDirections(fromAddress, toAddress, locale) {
gdir.load("from: " + fromAddress + " to: " + toAddress,
{ "locale": locale });
}
这是URL,我想我需要把它放在我所拥有的东西的某个地方 --我想我可以先用一种模式来测试它,比如“行走”。然后在下拉菜单生效后添加下拉菜单 =====================================
function calcRoute() {
var selectedMode = document.getElementById('mode').value;
var request = {
origin: haight,
destination: oceanBeach,
// Note that Javascript allows us to access the constant
// using square brackets and a string value as its
// "property."
travelMode: google.maps.TravelMode[selectedMode]
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
我在以下网址找到此网址:
=========================================
function calcRoute() {
var selectedMode = document.getElementById('mode').value;
var request = {
origin: haight,
destination: oceanBeach,
// Note that Javascript allows us to access the constant
// using square brackets and a string value as its
// "property."
travelMode: google.maps.TravelMode[selectedMode]
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
这是在上面的代码,我想使用它
travelMode:google.maps.travelMode[“行走”]我想出来了。我正在尝试向v2添加v3特性/语法。啊!(拍了拍额头)