Hi,
I am getting the coordinates with postal codes so I need the
Geocoder() function. After placing them using Marker(), i need to add
InfoWindow() to each markers.
1 records is working fine but mulitple records will have errors. E.g.:
as=['179433','729826','819643','320098'];
marker=[];
infowindow=[];
gm=google.maps;
function cc(){
geo=new google.maps.Geocoder();
for(i=0;i<as.length;i++){
geo.geocode({'address':as[i]},function(r,s){
marker[i]=new gm.Marker({map:map, position:r[0].geometry.location});
infowindow[i]=new gm.InfoWindow({content:'html content'+as[i]});
gm.event.addListener(marker[i],'click',function()
{infowindow[i].open(map,marker[i])});
});
}
}
If there are 4 records it will always take the last records because
"i" will be looped to 3 locally before any of the functions are
executed.
So how do I combine multiple geocoder, maker and infowindow in the
correct manner?
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.