the location is set, but you need a array to store the marker

try something like this:
var markers = [];
bn.Curiosity.initialize = function () {
   [code]
    google.maps.event.addListener(map, 'click', function (event) {

        var marker = new google.maps.Marker({
            position: event.latlng,
            map: map,
            visible: true,
            clickable: false,
            title: 'hello world'
        });
        markers.push(marker);
        map.setCenter(location);

    });

this should do the trick

On 16 Jun., 20:52, Cornelius Parkin <[email protected]>
wrote:
> Hi
>
> The most obvious thing I can see is that "location" is not set. It should be
> a latlong object.
>
> Regards
> CAP
>
>
>
>
>
>
>
>
>
> On Thu, Jun 16, 2011 at 5:29 PM, Jo <[email protected]> wrote:
> > So I have a map that appears... And I'm trying to add an even listener that
> > will create a marker when the user clicks a spot on the map. here's my js
> > code for initializing my map and adding a marker...
> > I know that the code reaches the creation of the marker... just nothing
> > happens! Help please!
>
> > bn.Curiosity.initialize = function () {
> >     var myLatlng = new google.maps.LatLng(54.397, -106.644);
>
> >     var map = new google.maps.Map(document.getElementById("map_canvas"), {
> >         zoom: 4,
> >         center: myLatlng,
> >         mapTypeId: google.maps.MapTypeId.ROADMAP
> >     });
>
> >     google.maps.event.addListener(map, 'click', function (event) {
>
> >         var marker = new google.maps.Marker({
>
> >             position: event.latlng,
> >             map: map,
> >             visible: true,
> >             clickable: false,
> >             title: 'hello world'
> >         });
> >         map.setCenter(location);
>
> >     });
> > }
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Maps JavaScript API v3" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/google-maps-js-api-v3/-/Zzg-wnlgU-cJ.
> > 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.
>
> --
> Warm Regards
>
> C.A.Parkin
>
> *~"When you innovate, you've got to be prepared for everyone telling you
> you're nuts" - Larry Ellison~*

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