62,243
社区成员




<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>事件监听函数参数</title>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
</head>
<body>
<div style="width:768px;height:450px;border:1px solid gray" id="container"></div>
<div id="info"></div>
</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("container");
map.centerAndZoom(new BMap.Point(110.741794, 19.607654), 15);
var opts = {type: BMAP_NAVIGATION_CONTROL_SMALL}
map.addControl(new BMap.NavigationControl(opts));
//创建小狐狸
var pt = new BMap.Point(110.741794, 19.607654);
var myIcon = new BMap.Icon("http://union.mapbar.com/apidoc/images/detail_mark.gif", new BMap.Size(24,24));
var marker = new BMap.Marker(pt,{icon:myIcon}); // 创建标注
map.addOverlay(marker); // 将标注添加到地图中
map.addEventListener("click", function(e){
document.getElementById("info").innerHTML = e.point.lng + ", " + e.point.lat;
});
</script>