info window custom close button

5,057 views
Skip to first unread message

alagar

unread,
Jul 23, 2010, 9:37:32 AM7/23/10
to Google Maps JavaScript API v3
Sorry for my English. I need custom buttons in infoWindow.

var map;
var infoWindow;
function initialize() {
var latlng = new google.maps.LatLng(47.030698,
28.850098);
var myOptions = {
zoom : 15,
center : latlng,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(
document.getElementById("map_canvas"),
myOptions);

google.maps.event.addListener(map, 'click',
function(event) {
placeReclameMarker(event.latLng);
});

}

function placeReclameMarker(location) {

var marker = new google.maps.Marker({
position: location,
draggable: true,
map: map
});

google.maps.event.addListener(marker,
'rightclick', function()
{ infoWindow = new google.maps.InfoWindow({
content: '<input type="button"
onclick="infoWindow.close()">'
});
infoWindow.open(map,marker);
});
}
when I click my button

button is pressed, the window closes and the map appears a new marker.
It turns out that when you close the window and fires onclick event.I
do not know how to fix it please help

Rossko

unread,
Jul 24, 2010, 5:58:27 AM7/24/10
to Google Maps JavaScript API v3
> button is pressed, the window closes and the map appears a new marker.
> It turns out that when you close the window and fires onclick event.I
> do not know how to fix it please help

See this similar recent thread
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/221876cc70bea9c6
Reply all
Reply to author
Forward
0 new messages