Google Maps JavaScript API Example //” + label +””); }); return marker; } function onLoad() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById(“map”)); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(20, 0), 1); // This code displays center coordinate at bottom of html GEvent.addListener(map, “moveend”, function() { var center = map.getCenter(); document.getElementById(“message”).innerHTML = center.toString(); }); // load XML and parse data to create map // GDownloadUrl(“locations.xml”, function(data, responseCode) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName(“marker”); //var icontype = “blue”; for (var i = 0; i < markers.length; i++) { var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); icontype = markers[i].getAttribute("icontype"); map.addOverlay(createMarker(point, markers[i].getAttribute("label"),markers[i].getAttribute("link"),icontype)); } }); } } //]]>
World | U.S. | California | U.S. Southeast | Europe | Africa | S. America |