Hi,

I have multiple maps on one page located here (http://70.87.99.34/
~texas/training-schedules.html?cityid=1), make sure to click "Austin
West" as the location.

If you use firebug you'll see that the page uses an XMLHttpRequest to
fetch the data from MySQL to display (via PHP)

The data may return a number of result sets which I loop through, each
result set has a map.

The loop uses a javascript iteration for(x in y).

The problem I am having is setting a unique variable for each map.

If there are 2 maps, then in the loop i need to declare..

mymap1 = new GMap(document.getElementById(mydiv_1);
mymap2 = new GMap(document.getElementById(mydiv_2);

correct me if i'm wrong, but to my knowledge there is no way to
concatenate a variable name to the left side of the equation...(ie.
'mymap' + i = ....)

i've tried the next logical thing which is to use an array, and i've
declared the array as global

maps = new Array();

in the loop..

var thismapid = 'gmap_' + x;
maps[x] =  new GMap(document.getElementById(thismapid);

this seems to work, except in testing the map with index 0 doesnt plot
a point.  So outside the end of the loop I started another for-in loop
to go through the maps array.  It does contain 2 GMap objects, so i
set the loop to set the zoom level of both maps = 1

for(b in maps){
        maps[b].setZoom(1);
}

the map with index of 0 zooms all the way out just fine, but the map
with index of 1 doesnt zoom at all.

I cant figure out whats up, is there a better way to go about
dynamically generating multiple maps on a page?

--

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