googlemap根据经纬度取地名

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>无标题页</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAZNVcM3B5rUU5SJeXURUaBxTBfUk9TZrBRaIteybtnU2KziHEpRTn4b5CncoKZUG6YvDa1nKeST_Y5A"
      type="text/javascript"></script>
       <script type="text/javascript">
    var geocoder = null;
    function addAddressToMap(response) {
      if (!response || response.Status.code != 200) {
        alert("对不起,不能解析这个地址");
      } else {
       
        var add="";
        for(var i=0;i<response.Placemark.length;i++)
        {
            add+=response.Placemark[i].address+" | ";
        }
        alert("您查找的位置是 : " + add);
      }
    }
 
    function showLocation(address) {

    if (GBrowserIsCompatible()) {
         geocoder = new GClientGeocoder();
         geocoder.getLocations(address, addAddressToMap);
      }
    }
 

    </script>
</head>
<body>
  <a href="javascript:void(0)"
     onclick="showLocation('26.08315043827389,119.29633140563965');return false;">
     取得地址 </a>
</body>
</html>

posted @ 2009-07-02 09:16  94cool  阅读(699)  评论(0)    收藏  举报