Doesn't
google.maps.event.addListener(map, 'click', function(event) {
placeMarker(event.latLng);
take care of map.setCenter()?
On Aug 23, 5:00 pm, "[email protected]" <[email protected]>
wrote:
> On Aug 23, 4:34 pm,whereschp<[email protected]> wrote:
>
> > On my map onhttp://whereschp.com/new/index.php?p=mainmapI'mnot able
> > to click the map to add a pin.
> > I'm using the same code on the tutorials but for some reason it's not
> > working at all.
>
> Well... if the tutorials work and your map doesn't, it can't be the
> "same code"...
>
> > This is my first time posting in these groups so I'm not very familiar
> > with the layout of how this works.
> > Is this supposed to be like a forum or am I going to get an email when
> > someone replies to this?
> > Next time are there tags I can wrap my source code in that will
> > display line numbers and color/format the code accordingly?
>
> Don't really need the code, you provided a link.
>
>
>
> > Thank you for reading!
>
> your map variable needs to be global:
>
> var map = null;> function load() {
>
> map = new google.maps.Map(document.getElementById("map"), {
>
> > center: new google.maps.LatLng(37.441063,-122.146683),
> > function placeMarker(location) {
> > var clickedLocation = new google.maps.LatLng(location);
> > var newmarker = new google.maps.Marker({
> > position: location,
> > map: map
> > });
>
> This is incorrect, you can't give map.setCenter a Marker object, you
> need to give it a LatLng:> map.setCenter(clickedLocation);
>
> map.setCenter(lcation);
>
> -- Larry
--
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.