Hello..i have two drawn circle on the map and i want when i click on the circle display the circle name..plz help me
function init() {
var mapDiv = document.getElementById('map-canvas');
var map = new google.maps.Map(mapDiv, {
center: new google.maps.LatLng(37.790234970864, -122.39031314844),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var mapcity = {};
mapcity['amman'] = { name: 'circle1', center: new google.maps.LatLng(37.790234970864, -122.39031314844), population: 50000 };
mapcity['zarqa'] = { name: 'circle2', center: new google.maps.LatLng(38.790234970864, -122.39031314844), population: 100000 };
var x = 0;
var obj = new Array();
for (var city in mapcity) {
if (mapcity[city].population > 60000) {
var color = 'ffffff'
}
else {
var color = 'aa34ff'
}
var cityInfo = {
strokeWeight: 2,
fillColor: color,
center: mapcity[city].center,
radius: mapcity[city].population,
map: map,
strokeColor: 'red',
strokeOpacity: 0.8,
fillOpacity: 0.3,
name: mapcity[city].name,
};
obj[x] = new google.maps.Circle(cityInfo);
x++;
}
google.maps.event.addListener(obj[x], 'click', function () {
alert(obj[x].name);
});
}
google.maps.event.addDomListener(window, 'load', init);