To put two maps on the page, the only thing that you need to alter is  
function mapsLoaded().  Specifically, you just need to duplicate and  
tweak the two lines that currently comprise that function, as below:

function mapsLoaded() {
  var map = new google.maps.Map2(document.getElementById("map"));
  map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
  var map2 = new  
google.maps.Map2(document.getElementById('second_map_div'));
  map2.setCenter(new google.maps.LatLng(second_lat,second_lng));
}


Then, of course, you would need to make sure there's a <div  
id="second_map_div"></div> somewhere on the page and that you define  
or replace second_lat and second_lng.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
[email protected]

Unless otherwise noted, any price quotes contained within this  
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights  
Wesleyan Church!

And check out my blog, Adventures in Web Development, at 
http://jgeerdes.blogspot.com 
  !


On Mar 30, 2009, at 5:50 PM, limo2040 wrote:

>
> In the following example posted on 
> http://code.google.com/apis/ajax/documentation/
>
> I am using the code below, so that the map won't hold up display of
> the page.
> And it is working great! However....
>
> function mapsLoaded() {
>  var map = new google.maps.Map2(document.getElementById("map"));
>  map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
> }
>
> function loadMaps() {
>  google.load("maps", "2", {"callback" : mapsLoaded});
> }
>
> function initLoader() {
>  var script = document.createElement("script");
>  script.src = "http://www.google.com/jsapi?
> key=ABCDEFG&callback=loadMaps";
>  script.type = "text/javascript";
>  document.getElementsByTagName("head")[0].appendChild(script);
> }
>
> Now I want to display two maps on the same page using this technique.
> However, I'll need a way to pass in the "id" of the element as an
> argument in the initLoader() but I'll be stuck here:
>
> script.src = "http://www.google.com/jsapi?
> key=ABCDEFG&callback=loadMaps";
>
> does jsapi support arguments passing into thte callback? If so, what
> would the name value pairs be in this url?
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" 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-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to