Hi,
I have a function that loops through the address column from a
gridview, geocodes each address, then places a marker on the map. When
I hover over each marker, the tooltip is the same for each marker and
keeps showing the the name of the last address in the gridview. I think
it may be a problem with closure in the for loop, but I have not been
able to figure this out. Any help would be greatly appreciated. Here is
the javascript:


function code_tableloop() {

var grid= document.getElementById("GridView1");

var rcount = grid.rows.length;

for (i=1; i<rcount; i++){

var address = grid.rows[i].cells[1].innerText + ', Louisville, KY';

geocoder.geocode({ 'address': address }, function (results, status) {

if (status == google.maps.GeocoderStatus.OK) {

map.setCenter(results[0].geometry.location);

var marker = new google.maps.Marker({

map:map,

position: results[0].geometry.location,

title: address,

icon: 'http://google.com/mapfiles/ms/micons/bus.png',

});

} else {

alert("Address not found for the following reason: " + status);

}

});

}

}

-- 
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.

Reply via email to