On 29 January 2011 15:20, Bruno <[email protected]> wrote:
> Hi,
>
> I've already been watching other discussions but can't find where I'm
> going wrong on my contact page http://www.petedonos.com/contact-form.php
> . Only one of the maps is working and I can't find the bug. Any help?
I can only find one map on that page. That's not working because of an
error, "map is not defined":
You define a variable to refer to the map div:
var map1 = new GMap2(document.getElementById("map1"));
and then use something different:
map.addControl(new GSmallMapControl());
However, you have two functions called "display_map()". Only one will
ever be called, and which one will depend on the browser. Some use the
first and ignore the second; some use the second because it supersedes
the first. For two maps, the div ids, the variables referring to them,
everything needs to be unique.
You can have just ONE function display_map() and set up both maps in
the single function.
function display_map() {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
//etc
var map1 = new GMap2(document.getElementById("map1"));
map1.addControl(new GSmallMapControl());
//etc
}
--
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.