google地图取添加标注(取经纬度,并显示该位置显图标)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Google Maps JavaScript API Example - simple</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=aaaaa"
type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="map" style="width: 300px; height: 300px"></div>
<script type="text/javascript">
//<![CDATA[

if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.441944, -122.141944), 13);
}

GEvent.addListener(map, 'click', function(overlay, point) {
if (point) {
document.getElementById("show_x").innerHTML = point.x;
document.getElementById("show_y").innerHTML = point.y;
}
});

//]]>
</script>

<P id="show_x"></P>
<P id="show_y"></P>

</body>

</html>

http://code.google.com/intl/zh-CN/apis/maps/documentation/examples/event-arguments.html

上一篇: discuz 数据表对照   下一篇: mapabc地图取添加标注(取经纬度,并显示该位置显图标)

提交疑问

回顶部