我已經實現了谷歌標記,並且我想在標記內顯示一個名稱。我試圖改變標籤:如下面的代碼,但它只顯示第一個字符..可以有人告訴我如何解決這個問題?在谷歌地圖標記中顯示多個字符
這裏是從谷歌的代碼標記
function initialize() {
var bangalore = { lat: 12.97, lng: 77.59 };
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: bangalore
});
// This event listener calls addMarker() when the map is clicked.
google.maps.event.addListener(map, 'click', function(event) {
addMarker(event.latLng, map);
});
// Add a marker at the center of the map.
addMarker(bangalore, map);
}
// Adds a marker to the map.
function addMarker(location, map) {
// Add the marker at the clicked location, and add the next-available label
// from the array of alphabetical characters.
var marker = new google.maps.Marker({
position: location,
label: "lets showthis",
map: map
});
}
google.maps.event.addDomListener(window, 'load', initialize);
可能重複http://stackoverflow.com/questions/32467212/google-maps-marker-label-with-multiple-characters) – geocodezip