How can add infoWindow for dyanamic and multiple maker? i have try in
lots of way but at last I invent a solution as given below:

function initialize()
{


                 var locations = [
                  ['Bondi Beach', -33.890542, 151.274856],
                  ['Coogee Beach', -33.923036, 151.259052],
                  ['Cronulla Beach', -34.028249, 151.157507],
                  ['Manly Beach', -33.80010128657071, 151.28747820854187],
                  ['Maroubra Beach', -33.950198, 151.259302]
                ];

                var latlng = new google.maps.LatLng(-33.890542, 151.274856);

                var settings = {
                                zoom: 10,
                                center: latlng,
                                mapTypeControl: true,
                                mapTypeControlOptions: {style:
google.maps.MapTypeControlStyle.DROPDOWN_MENU},
                                navigationControl: true,
                                navigationControlOptions: {style:
google.maps.NavigationControlStyle.SMALL},
                                mapTypeId: google.maps.MapTypeId.ROADMAP
                }
                var map = new
google.maps.Map(document.getElementById("mapContainer"), settings); //
div id diplay map

                var companyLogo = new google.maps.MarkerImage("parking.png",
                        new google.maps.Size(100,50),
                        new google.maps.Point(0,0),
                        new google.maps.Point(50,50)
                );
                var companyShadow = new
google.maps.MarkerImage("parking_shadow.png",
                        new google.maps.Size(130,50),
                        new google.maps.Point(0,0),
                        new google.maps.Point(65, 50)
                );
                var companyMarker=[];
                var infowindow=[];
                var loc=null;
                var myLatLng=null;
                for(var i = 0; i < locations.length; i++){

                        loc = locations[i];
                        myLatLng = new google.maps.LatLng(loc[1], loc[2]);
                        eval("var companyMarker"+i+" = new google.maps.Marker({ 
position:
myLatLng,       map: map, icon: companyLogo, shadow: companyShadow,
title:loc[0],zIndex: i});");
                }
                var a=[];
                for(i=0;i< locations.length; i++){

                        google.maps.event.addListener(eval("companyMarker"+i), 
'click',
function() {
                                var ind = $(this).attr('z-index');
                                if (infowindow[ind]) infowindow[ind].close();
                                eval("var infowindow"+ind+" = new 
google.maps.InfoWindow({content:
locations[ind][0]});");
                                eval("infowindow"+ind).open(map, 
eval("companyMarker"+ind));
                        });
                }
}

$(document).ready( function () {
        initialize();
});

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