我在使用 Google Maps API V3 时遇到了困难。我可以在我的地图上显示几个标记(3 个标记),但每个标记都有相同的标题(Maurice GENEVOIX)。你能帮我/告诉我怎么做吗?我想不通。我有以下代码:
function initialize() {
var myMarker=null;
var i=0;
var GeocoderOptions;
var myGeocoder;
var nom;
var temp;
var info = [
['57 Avenue Joseph Kessel 78180 Montigny-le-Bretonneux','Paul VERLAINE'],
['24 Rue du champ d avoine 78180 Mintigny-le-Bretonneux','Pauline VERLAINE'],
['21 Rue du Poirier Saint Martin 78180 Mintigny-le-Bretonneux','Maurice GENEVOIX']
];
var mapOptions = {
center: new google.maps.LatLng(48.772, 2.028),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
function GeocodingResult( results , status , i)
{
if(status == google.maps.GeocoderStatus.OK){
myMarker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: nom,
icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'
});
} else {
alert("L'adresse n'a pas pu etre geocodee avec succes.");
}
}
for(i=0;i<info.length;i++){
GeocoderOptions={
'address' : info[i][0],
'region':'FR'
};
nom=info[i][1];
myGeocoder = new google.maps.Geocoder();
myGeocoder.geocode( GeocoderOptions, GeocodingResult );
}
}
google.maps.event.addDomListener(window, 'load', initialize);