<!--1、引入JavaScript文件-->
<script language="javascript" src=" http://api.51ditu.com/js/maps.js
"></script>
</head>
<body>
<!--3、创建地图对象-->
<script language="javascript">
var toolTipLayer=document.createElement("DIV");
toolTipLayer.id="myMap";
toolTipLayer.style.position="absolute";
toolTipLayer.style.left="200px";
toolTipLayer.style.width="400px";
toolTipLayer.style.height="300px";
toolTipLayer.style.top="200px";
document.body.appendChild(toolTipLayer);
var maps = new LTMaps( "myMap" );
maps.cityNameAndZoom( "beijing" , 5 );
LTEvent.addListener( maps , "click" , b );
function
b(p)//p为鼠标单击事件传入的参数鼠标的位置相对于地图左上角的像素坐标
{
alert(p[0]);
alert(p[1]);
alert(p);
lpot=maps.getPointLatLng(p)//得到LTPOINT对象
var marker = new LTMarker( lpot);//产生标记
maps.addOverLay( marker );
alert("标记增加完成");
}
</script>
</body>
</html>