代码:(应有的js做好下载到本地)
<
html
>
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=GBK" >
< title ></ title >
< script type ="text/javascript" src ="http://api.mapbar.com/api/mapbar20.js" ></ script >
< script type ="text/JavaScript" > ...
oo = false;
var maplet;
var mw = 0;//防止滚屏!!
var iToolTipStyle =0;
MIN_BUBBLE_HEIGHT = 120;//气泡提示框最小高度
STD_TIP_HEIGHT = 20;//气泡提示框下面空白高度
function init()...{
maplet = new Maplet("mapbar");
maplet.centerAndZoom(new MPoint("北京市"),8);
maplet.clean();
maplet.addControl(new MStandardControl());
//maplet.addControl(new MMSNControl());
maplet.refresh();
}
</ script >
</ head >
< body onLoad ="init();" topmargin ="0" leftmargin ="0" >
< div id ="mapbar" style ="position:relative;top:0;left:0;width:640;height:480;" ></ div >
</ body >
</ html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=GBK" >
< title ></ title >
< script type ="text/javascript" src ="http://api.mapbar.com/api/mapbar20.js" ></ script >
< script type ="text/JavaScript" > ...
oo = false;
var maplet;
var mw = 0;//防止滚屏!!
var iToolTipStyle =0;
MIN_BUBBLE_HEIGHT = 120;//气泡提示框最小高度
STD_TIP_HEIGHT = 20;//气泡提示框下面空白高度
function init()...{
maplet = new Maplet("mapbar");
maplet.centerAndZoom(new MPoint("北京市"),8);
maplet.clean();
maplet.addControl(new MStandardControl());
//maplet.addControl(new MMSNControl());
maplet.refresh();
}
</ script >
</ head >
< body onLoad ="init();" topmargin ="0" leftmargin ="0" >
< div id ="mapbar" style ="position:relative;top:0;left:0;width:640;height:480;" ></ div >
</ body >
</ html >
首先,在body中必须有一个div id=“mapbar”,调整地图款高可以改width:640;height:480处
方法init是载入网页完成时执行的方法
显示某个城市关键代码
maplet.centerAndZoom(new MPoint("北京市"),8);
其中的 “北京市” 可以换成其他城市的 ,例如“上海市”
应用的js是 版本20的js ,有点bug,回报js错误