try placeMarker.push(event.latLng) but i dont know why you want to do this on part of the code... read this first before posting
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/2b3f101fd509919e please!!! On 6 Jun., 23:56, a jay <[email protected]> wrote: > i am new to JS would you be able to provide a more detailed explanation ? > i would like to limit the user to place 2 markers on the map. > thanks > > > > > > > > On Mon, Jun 6, 2011 at 2:54 PM, en4ce <[email protected]> wrote: > > this placeMarker(event.latLng); is a function not an array, to fill > > your placeMarker array use the normal js methods > > > On 6 Jun., 23:35, a jay <[email protected]> wrote: > > > hi, i am trying to limit the marker to add only two markers to a map on > > > click event > > > i wrote an event listener and added the following code to it: > > > > GEvent.addListener(map, 'click', function (overlay, latlng) { > > > if (placeMarker.length < 2) { > > > pendingLatLng = latlng; > > > setTimeout("settleClick()", 225) > > > } > > > else { > > > message("You can only select 2 points."); > > > } > > > }); > > > > a sample click event which looks like the line below does work. what am i > > > doing wrong ?: > > > google.maps.event.addListener(map, 'click', function (event) > > > {placeMarker(event.latLng); }) > > > -- > > 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. -- 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.
