bingMap的js引用
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=zh-cn"></script>
mkt=en-us:英文显示【默认选项】
mkt=zh-cn:中文显示
在BingMap的官网地图上我还真没有找到设置显示中文的选项。
Test code:
Html:
- <form id="form1" runat="server">
- <div id="divMap">
- </div>
- </form>
<form id="form1" runat="server">
<div id="divMap">
</div>
</form>
Js:
- <script type="text/javascript">
- var map = null;
- var bingMapKey = "AvHCAx5M3rKrzF-3b_DpRotDCe5Bs53FsqmGhg6i4t0ISDPjadyZsCke61VGacfd";
- var infobox = null;
- $(document).ready(function ()
- {
- var mapOptions = {
- credentials: bingMapKey,
- enableClickableLogo: false,
- enableSearchLogo: false,
- showMapTypeSelector: true,
- showCopyright: false,
- mapTypeId: Microsoft.Maps.MapTypeId.road,
- //zoom: 10,
- //animate:false
- useInertia:false
- };
- map = new Microsoft.Maps.Map($('#divMap')[0], mapOptions);
- var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(41, -72));
- // Add a handler to the pushpin drag
- Microsoft.Maps.Events.addHandler(pushpin, 'click', DisplayLoc);
- map.entities.push(pushpin);
- //Infobox
- var infoboxOptions = {
- width: 300,
- height: 100,
- title: "Title1",
- description: "Description1",
- animate: false,
- showPointer: false
- };
- infobox = new Microsoft.Maps.Infobox(pushpin, infoboxOptions);
- map.entities.push(infobox);
- var _chartLayer = new Microsoft.Maps.EntityCollection();
- map.entities.push(_chartLayer);
- })
- </script>