PHP calls Google API map display code
Google.load ("Maps", "2.x");
Google.setonloadcallback (initialize);
var map = null;
var geocoder = null;
function Initialize () {
Detect if IE supports Google Map API
if (gbrowseriscompatible ()) {
Map = new Google.maps.Map2 (document.getElementById (' map '));
Geocoder = new Gclientgeocoder ();
Set up a map center
Map.setcenter (New Glatlng (25.036772,121.520269), 12);
}//If
else {
Alert (' Your traffic does not support Google Map ');
}//Else
}
function Showlocation () {
Clear Marker
Map.clearoverlays ();
var address = document.getElementById (' txtaddress '). Value;
Geocoder.getlocations (address, cb_showlocation);
}
function Cb_showlocation (Result) {
Show results
if (result. Status.code = = g_geo_success) {
Success
for (var i=0; I<result. Placemark.length; i++) {
var lat = result. Placemark[i]. POINT.COORDINATES[1];
Lat
var LNG = result. Placemark[i]. Point.coordinates[0];
Lng
var address = result. placemark[i].address; Address
var point = new Glatlng (LAT,LNG);
var marker=new gmarker (Point, {title:i+1});;
Map.addoverlay (marker);
}//For
}//If
}
Var status=[];
status[g_geo_success] = "SUCCESS";
status[g_geo_missing_address] = "MISSING address";
status[g_geo_unknown_address] = "UNKNOWN address";
status[g_geo_unavailable_address]= "unavailable address";
status[g_geo_bad_key] = "Bad KEY";
status[g_geo_too_many_queries] = "TOO MANY QUERIES";
status[g_geo_server_error] = "SERVER ERROR";