That doesn't look too bad, but I can't try it properly without the rest of the page. I'd keep an array with the markers themselves, so that I could later on remove them from the map, but that's up to you.
On Fri, Jun 11, 2010 at 12:06, Sven Nijs <[email protected]> wrote: > Do you have time to help me with that? I don't know how to start... I tried > it this way: > > > var myLatLng = new google.maps.LatLng(lat, lng); > pointMarker.push(new google.maps.Marker({ > position: myLatLng, > map: map, > icon: image > })); > locMarker.push(myLatLng); > > google.maps.event.addListener(pointMarker[i], 'click', function(event){ > > > > alert(locMarker[i]); > startPoint = true; > > }); > > > > 2010/6/11 Miguel Angel Vilela <[email protected]> > >> Ah, you have many markers, in that case you need to keep track of them, >> e.g. in an Array. >> >> >> On Fri, Jun 11, 2010 at 11:39, Nijs9 <[email protected]> wrote: >> >>> Thanks, but in this way he takes the position of the last added >>> marker. I use a loop to add more than 100 markers, in this way I get >>> only the position of the last added, on each marker i click... >>> >>> On 11 jun, 11:33, Miguel Angel Vilela <[email protected]> wrote: >>> > Try with beachMarker.getPosition() >>> > >>> > http://code.google.com/apis/maps/documentation/javascript/reference.h. >>> .. >>> > >>> > >>> > >>> > On Fri, Jun 11, 2010 at 11:11, Nijs9 <[email protected]> wrote: >>> > > I create a custom marker in this way, but when I add the click event >>> I >>> > > dont know how to get the Latitude and longitude out of that marker. >>> > > Does anybody know how to do it?: >>> > >>> > > // create the marker >>> > > var image = new google.maps.MarkerImage('http://www.vfr.be/Images/ >>> > > waypoint.png', >>> > > new google.maps.Size(20, 20), >>> > > new google.maps.Point(0,0), >>> > > new google.maps.Point(10, 10)); >>> > > var myLatLng = new google.maps.LatLng(lat, lng); >>> > > var beachMarker = new google.maps.Marker({ >>> > > position: myLatLng, >>> > > map: map, >>> > > icon: image >>> > > }); >>> > >>> > > google.maps.event.addListener(beachMarker, 'click', function(){ >>> > >>> > > alert(beachMarker.LatLng() + "|" + beachMarker.lng()); >>> > > startPoint = true; >>> > >>> > > }); >>> > >>> > > -- >>> > > 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]<google-maps-js-api-v3%[email protected]> >>> <google-maps-js-api-v3%2b[email protected]> >>> > > . >>> > > For more options, visit this group at >>> > >http://groups.google.com/group/google-maps-js-api-v3?hl=en.- Tekst >>> uit oorspronkelijk bericht niet weergeven - >>> > >>> > - Tekst uit oorspronkelijk bericht weergeven - >>> >>> -- >>> 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]<google-maps-js-api-v3%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/google-maps-js-api-v3?hl=en. >>> >>> >> -- >> 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]<google-maps-js-api-v3%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/google-maps-js-api-v3?hl=en. >> > > -- > 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]<google-maps-js-api-v3%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > -- 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.
