我已经实现了谷歌标记,并且我想在标记内显示一个名称。我试图改变标签:如下面的代码,但它只显示第一个字符..可以有人告诉我如何解决这个问题?在谷歌地图标记中显示多个字符
这里是从谷歌的代码标记
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