<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Mapbar 地图 JavaScript API 示例: 地图标注</title>
<script type="text/javascript" src="http://union.mapbar.com/apis/maps/free?f=mapi&v=31&k=aCW9cItqL7sqT7AxaB0zdHTzOIJrNyTrEeJyMYgnTREnZRV6El==@qTMWEInEnnqNOT0xBxyBMM6EMBIBTVgynBEryxtETTB0BTrTVTT=qIEI=EaTTI@9eyBMzyTFJ9="></script>
<script type="text/javascript">
var maplet = null;
var marker = null;
function initMap(){
maplet = new Maplet("mapbar");
maplet.centerAndZoom(new MPoint(116.38672,39.90805), 10);
maplet.addControl(new MStandardControl());
maplet.setMode("bookmark",function(dataObj){
if(marker!=null)
{
maplet.removeOverlay(marker);
}
document.getElementById("x").value=dataObj.point.lon;
document.getElementById("y").value=dataObj.point.lat;
marker = new MMarker(
dataObj.point,
new MIcon("../images/haha.gif",32,32)
);
maplet.addOverlay(marker);
marker.setEditable(true);
MEvent.addListener(marker,"drag",function(){
document.getElementById("x").value=this.pt.lon;
document.getElementById("y").value=this.pt.lat;
});
});
}
</script>
</head>
<body οnlοad="initMap()">
<div id="mapbar" style="width:600px;height:500px"></div>
经度<input id="x" type="text" />
纬度<input id="y" type="text" />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Mapbar 地图 JavaScript API 示例: 地图标注</title>
<script type="text/javascript" src="http://union.mapbar.com/apis/maps/free?f=mapi&v=31&k=aCW9cItqL7sqT7AxaB0zdHTzOIJrNyTrEeJyMYgnTREnZRV6El==@qTMWEInEnnqNOT0xBxyBMM6EMBIBTVgynBEryxtETTB0BTrTVTT=qIEI=EaTTI@9eyBMzyTFJ9="></script>
<script type="text/javascript">
var maplet = null;
var marker = null;
function initMap(){
maplet = new Maplet("mapbar");
maplet.centerAndZoom(new MPoint(116.38672,39.90805), 10);
maplet.addControl(new MStandardControl());
maplet.setMode("bookmark",function(dataObj){
if(marker!=null)
{
maplet.removeOverlay(marker);
}
document.getElementById("x").value=dataObj.point.lon;
document.getElementById("y").value=dataObj.point.lat;
marker = new MMarker(
dataObj.point,
new MIcon("../images/haha.gif",32,32)
);
maplet.addOverlay(marker);
marker.setEditable(true);
MEvent.addListener(marker,"drag",function(){
document.getElementById("x").value=this.pt.lon;
document.getElementById("y").value=this.pt.lat;
});
});
}
</script>
</head>
<body οnlοad="initMap()">
<div id="mapbar" style="width:600px;height:500px"></div>
经度<input id="x" type="text" />
纬度<input id="y" type="text" />
</body>
</html>