Hi Blaine
It sounds like you might be declaring your map variable inside a function.
Try declaring it outside of a function and initializing inside like so:
var map;
function initialize() {
var myLatlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("mapCanvas"), myOptions);
}
On Wed, Apr 21, 2010 at 6:43 PM, Blaine <[email protected]> wrote:
> I have a div with id="mapCanvas"
>
> I create a map inside the div
> var map = new google.maps.Map(document.getElementById("mapCanvas"),
> myOptions);
>
>
> Assuming that the function that creates the map has completed and I
> have now lost the map var.
>
> How do I get a reference back to the existing map when I only know the
> div it is in?
>
> var oldmap = document.getElementById("mapCanvas").theMapInisdeThisDiv;
>
> --
> 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]<google-maps-js-api-v3%[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.