you add listeners in your init function, yours is named:  function
load()

so just do like that to add any listeners:

function load() {

--> yourcode

google.maps.event.addListener(map, 'click', function(event) {
  addMarker(event.latLng);
});


}

function addMarker(latLng){
var marker = new google.maps.Marker({
                position: latLng,
                map: map,
                title: "blub",
                bouncy: true,
                draggable: true
              })
marker.setIcon(iconForMarker);
}

see here for more event listeners:
http://code.google.com/intl/de-DE/apis/maps/documentation/javascript/events.html

On 7 Feb., 23:00, John <[email protected]> wrote:
> I tried a lot of things but I can't get it working. I'm not understanding
> how to add a listner to the map. Is it possible to do that in a separate
> function?
> What I want is the possibility to add a marker on the map only if the marker
> button is selected.
>
> I hope someone can give me another tip because it's really driving me
> crazy...........................
>
> Thanks!!
>
> John
>
> The URL to the map is:http://www.houdstadsweidengroen.nl/maps/map_v3nw14.html

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