程序清单如下:
<div id="myMap" style="position:relative; width:800px;
height:600px;"></div>
<script language="javascript">
var maps = new LTMaps( "myMap" );
maps.cityNameAndZoom( "beijing" , 5 );
var x,y;
var control = new LTMarkControl();
maps.addControl( control );
function getPoi()
{
var poi = control.getMarkControlPoint();
x = poi.getLatitude();
y = poi.getLongitude();
showPoi();
// alert( "纬度:" + x + "\n经度:" + y );
}
LTEvent.addListener( control , "mouseup" , getPoi );
function showPoi()
{
var point = new LTPoint( x/*11643648*/ , y/* 3983040*/ );//北京
var infoWin = new LTInfoWindow( point );
infoWin.setLabel( "<a href='http://www.51ditu.com'
target='_blank'>http://www.51ditu.com</a>" );
maps.addOverLay( infoWin );
alert( "纬度:" + x + "\n经度:" + y );
}
var point = new LTPoint( 11643648 , 3983040 );//北京
var infoWin = new LTInfoWindow( point );
infoWin.setLabel( "<a href='http://www.51ditu.com'
target='_blank'>http://www.51ditu.com</a>" );
maps.addOverLay( infoWin );
</script>