you need to call the InfoWindow constructor once at the start of the
program, then open it with new content on the marker clicks, something
like this:
var MyInfoWindow = new google.maps.InfoWindow();
var Argentina = new google.maps.LatLng(-33.6,-64.383333);
var ArgentinaMarker = new google.maps.Marker({
position: Argentina,
map: map,
title:"Argentina"
});
google.maps.event.addListener(ArgentinaMarker, 'click', function() {
MyInfoWindow.setContent("<b>Argentina</b><br>World Cups: 1978,
1986");
MyInfoWindow.open(map, ArgentinaMarker);
});
var Uruguay = new google.maps.LatLng(-32.723,-55.679);
var UruguayMarker = new google.maps.Marker({
position: Uruguay,
map: map,
title:"Uruguay"
});
google.maps.event.addListener(UruguayMarker, 'click', function() {
MyInfoWindow.setContent("<b>Uruguay</b><br>World Cups: 1930,
1950");
MyInfoWindow.open(map, UruguayMarker);
});
var Brazil = new google.maps.LatLng(-12.726,-52.295);
var BrazilMarker = new google.maps.Marker({
position: Brazil,
map: map,
title:"Brazil"
});
google.maps.event.addListener(BrazilMarker, 'click', function() {
MyInfoWindow.setContent("<b>Brazil</b><br>World Cups: 1958,
1962, 1970, 1994, 2002");
MyInfoWindow.open(map, BrazilMarker);
});
...
--
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.