Hi,

I'm having trouble posting multiple maps on 1 page. Please look at the
following page as an example.

http://www.getagig.info/new/search.php --- in the search box type
"Manchester" (without quotes) so the maps will generate.

As you will see a map only appears in the first pull down box, not all
of them, as it should.

I'm pretty useless when it comes to JS, knowing only PHP, so my
apologies if this is a simple fix. The code I'm looping within the
page to render the map is below. At the moment I have 1 instance of
this code per map entry within the content of the HTML (please see my
page for more info).

Many thanks

Best wishes

-------------------------

<script type="text/javascript">
var map;
var localSearch = new GlocalSearch();

var icon = new GIcon();
icon.image = "http://www.google.com/mapfiles/marker.png";;
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";;
icon.iconSize = new GSize(20, 34);
icon.shadowSize = new GSize(37, 34);
icon.iconAnchor = new GPoint(10, 34);


function usePointFromPostcode(postcode, callbackFunction) {

        localSearch.setSearchCompleteCallback(null,
                function() {

                        if (localSearch.results[0])
                        {
                                var resultLat = localSearch.results[0].lat;
                                var resultLng = localSearch.results[0].lng;
                                var point = new GLatLng(resultLat,resultLng);
                                callbackFunction(point);
                        }else{
                                alert("Postcode not found!");
                        }
                });

        localSearch.execute(postcode + ", UK");
}


function setCenterToPoint(point)
{
        map.setCenter(point, 17);
        var marker = new GMarker(point,icon);
        map.addOverlay(marker);
}


function mapLoad() {
        if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
                map.addControl(new GLargeMapControl());
                map.addControl(new GMapTypeControl());
                map.setCenter(new GLatLng(54.622978,-2.592773), 5, 
G_NORMAL_MAP);
        }
}

<script>
window.onload = function() {
mapLoad();
usePointFromPostcode("M139PR", setCenterToPoint);
}
</script>

-----------------------

--~--~---------~--~----~------------~-------~--~----~
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