Please read Pil's post again. Particularly this part: > > This is no invitiation to post the whole code but a hint to read the > > posting guide lines and post a link.
-- Larry On Jun 22, 8:53 am, Johannes <[email protected]> wrote: > Hi Pil, > thanks for reply! > > The Code which i use to initialize: > > var map; > var markersArray = []; > > function initialize() { > var haightAshbury = new google.maps.LatLng(51.151786,9.115039); > var mapOptions = { > zoom: 8, > center: haightAshbury, > mapTypeId: google.maps.MapTypeId.ROADMAP > }; > map = new google.maps.Map(document.getElementById("map_canvas"), > mapOptions); > > google.maps.event.addListener(map, 'rightclick', function(event) { > addMarker(event.latLng); > }); > google.maps.event.addListener(marker, 'click', function() { > //markerClick(this); > alert("test"); > }); > > } > > function markerClick( mark ) > { > for ( var m = 0; m < markersArray.length; ++m ) > { > if ( markersArray[m] == mark ) > { > map.set_center(store_locations[m]); > map.set_zoom(16); > return; > } > } > > } > > function addMarker(location) { > marker = new google.maps.Marker({ > position: location, > map: map > }); > markersArray.push(marker); > > } > > // Removes the overlays from the map, but keeps them in the array > function clearOverlays() { > if (markersArray) { > for (i in markersArray) { > markersArray[i].setMap(null); > } > } > > } > > // Shows any overlays currently in the array > function showOverlays() { > if (markersArray) { > for (i in markersArray) { > markersArray[i].setMap(map); > } > } > > } > > // Deletes all markers in the array by removing references to them > function deleteOverlays() { > if (markersArray) { > for (i in markersArray) { > markersArray[i].setMap(null); > } > markersArray.length = 0; > } > > } > > This code is available from the google examples. I think the problem > is caused by using the marker array? Before i had another way to set > markers, without pushing it into an array - and the listener worked! > Now, he is simply doing nothing :/ > > greets jo > > On Jun 22, 2:32 pm, Pil <[email protected]> wrote: > > > On Jun 22, 1:41 pm, Johannes <[email protected]> wrote: > > > > Wo könnte das Problem liegen? > > > In your code which we can see only partially. > > > Where is marker defined? What does the function addMarker() do and > > where is it? > > Is map a global or a local variable? What are the chars after the last > > brace for? Is your HTML valid? > > > This is no invitiation to post the whole code but a hint to read the > > posting guide lines and post a link. > > -- 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.
