-1
我正在使用Google Maps API v3,并试图在地图上放置多个标记。多标记问题(Google Maps API v3)
这是我的代码:
var map;
var geocoder;
var bulleInfo = null;
var marker = null;
var siteLatLng;
var globalAddress;
var globalLocation;
var globalFirstName;
var globalLastName;
function initialize()
{
var centerMap = new google.maps.LatLng(48, 1);
var myOptions = {
zoom: 4,
center: centerMap,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
geocoder = new google.maps.Geocoder();
bulleInfo = new google.maps.InfoWindow({
content: "loading..."
});
}
function codeAddress(profiles)
{
for(i=0; i < profiles.length; i++) {
globalLocation = profiles[i].location;
globalFirstName = profiles[i].first_name;
globalLastName = profiles[i].last_name;
geocoder.geocode({'address': globalLocation}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
globalAddress = results[0].geometry.location;
putMarkers();
}
else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
function putMarkers()
{
marker = new google.maps.Marker({
map: map,
position: globalAddress,
zIndex: i,
html: globalFirstName
});
google.maps.event.addListener(marker, 'click', function() {
bulleInfo.setContent(this.html);
bulleInfo.open(map, this);
});
}
的问题是,所有的指标都是一样的(等于曲线的最后一个元素)!
出了什么问题?
谢谢!
谢谢关怀!将看看你的例子! – 2010-11-28 01:46:44