87,910
社区成员
发帖
与我相关
我的任务
分享
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAA9Ot9Dal8oVohqNGTUB61oRQLjaRHydcRGDb-HBpcbU38szWFQBR-wymCIqIGN6F1_4YQvg-O9H3ntg" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(39.917, 116.397), 13);/*这里我改成(121.4838, 31.2517), 3也不行*/
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert("不能解析: " + address);
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
</script>
<body onload="initialize()" onunload="GUnload()">
〖地理位置〗
<div id="map_canvas" style="width: 500px; height: 300px"></div>