差異處
這裏顯示兩個版本的差異處。
下次修改 | 前次修改 | ||
start:google:maps [2009/12/14 14:23] – 建立 jonathan | start:google:maps [2009/12/14 14:25] (目前版本) – jonathan | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== Google 地圖找座標 ====== | ||
+ | < | ||
+ | < | ||
+ | <meta http-equiv=" | ||
+ | < | ||
+ | <script src=" | ||
+ | type=" | ||
+ | <script type=" | ||
+ | |||
+ | var map; | ||
+ | var geocoder; | ||
+ | var address; | ||
+ | |||
+ | function initialize() { | ||
+ | map = new GMap2(document.getElementById(" | ||
+ | map.setCenter(new GLatLng(25.046412, | ||
+ | map.setUIToDefault(); | ||
+ | GEvent.addListener(map, | ||
+ | geocoder = new GClientGeocoder(); | ||
+ | } | ||
+ | | ||
+ | function getAddress(overlay, | ||
+ | if (latlng != null) { | ||
+ | address = latlng; | ||
+ | geocoder.getLocations(latlng, | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function showAddress(response) { | ||
+ | map.clearOverlays(); | ||
+ | if (!response || response.Status.code != 200) { | ||
+ | alert(" | ||
+ | } else { | ||
+ | place = response.Placemark[0]; | ||
+ | point = new GLatLng(place.Point.coordinates[1], | ||
+ | place.Point.coordinates[0]); | ||
+ | marker = new GMarker(point); | ||
+ | map.addOverlay(marker); | ||
+ | marker.openInfoWindowHtml( | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <body onload=" | ||
+ | <div id=" | ||
+ | </ | ||
+ | </ | ||