Yes, thanks, I know this example and this code, sure, otherway it should be
absolutely stupid question)
But, seems to be, I've described the problem in non-clarified manner:

Just after the some user's  manipulation on page Map loads markers ans shows
them (data from database).
And I have another button where I ask the B and L from user and I add new
marker, using this new info.
So, if I write:

 var map = new GMap2(document.getElementById("map_canvas"));

I'm getting new instanse of Map without already existed markers and info
windows. That's problem - I'd like to have "old" map-object and
add to it new marker.




2011/2/2 Andrew Leach <[email protected]>

> On 1 February 2011 21:18, Eugene <[email protected]> wrote:
> >  Please, help for beginner:
> > I have Google map in HTML page, which declared in HTML as DIV-element
> > (as it made in example)
> >
> >  <div id="map_canvas" style="width:610px;height:470px;border:1px
> > solid;">
> >
> > In another part of this HTML-page I want to request to this Map and
> > set marker on it.
> > In JavaScript I write
> >
> > document.getElementById("map_canvas")
> >
> > but, sure, I'm getting the object "HTMLDivElement".
> > So, is there any way to get access to existed map on page ?
>
> I suggest following the examples, particularly
>
> http://code.google.com/apis/maps/documentation/javascript/v2/examples/marker-simple.html
>
> That one uses a loop to create 10 random locations and place a marker
> at each of them. The relevant lines for a single marker are
>  var map = new GMap2(document.getElementById("map_canvas"));
>  map.setCenter(new GLatLng(..., ...), ...); // needs lat, lng, zoom for map
>  var latlng = new GLatLng(..., ...); // needs lat, lng for marker
>  map.addOverlay(new GMarker(latlng));
>
> That is, document.getElementById("map_canvas") is indeed an
> div-element object. But the "new GMap2(...)" uses that div for the
> map, and you get hold of the map by assigning it to a variable, "var
> map" in this case.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API V2" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" 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-api?hl=en.

Reply via email to