Is there a more dynamic way of doing this other than hardcoding the
div ids and altering the js?

On Dec 8 2008, 9:26 pm, Brett DeWoody <[email protected]> wrote:
> Hi LN,
>
> Larry is correct in that you don't need two API keys.  This is
> possible to do as is shown in the link Ralph added.  I'll give a brief
> tutorial on what they're doing to accomplish this.
>
> Let's start with just a single map.  To add a single map on the page
> you create an element with a unique id.  Let's say we give it an id of
> "map1".
>
> <div id="map1"></div>
>
> In your GoogleMapsjavascript code in your page, when you instantiate
> the GMap2 class you tell it where to display the map by giving it the
> unique id you set before. In this case that would be "map1".  The
> javascript looks like this:
>
> var map1 = new GMap2(document.getElementById("map1"));
>
> There would of course be some other parameters set for the map1
> variable (center lat/lng, markers, etc).
>
> To add a second map, you'll basically create a new element on your
> page with a new unique id.  Let's give it and it an id of "map2".
>
> <div id="map2"></div>
>
> Then in your javascript you'll create the new map element, and pass
> the new unique id to it.  Like this:
>
> var map2 = new GMap2(document.getElementById("map2"));
>
> Again, you'll likely have some other parameters for map2, like
> Markers, etc.  Take a look at the source code for the page Larry
> included (http://www.easypagez.com/maps/twomaps.html) and you'll see
> some of the elements I have here.
>
> Hope this helps!
>
> -Brett
>
> On Dec 8, 11:33 am, LN <[email protected]> wrote:
>
> > Hi
>
> > I like to addmultipleGooglemapson 1 web page. How do I do that? Is
> > it necessary with different api codes on each map?
>
> > LN
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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