BingMap地图显示中文



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:

  1. <form id="form1" runat="server">  
  2.     <div id="divMap">  
  3.       
  4.     </div>  
  5.     </form>  
<form id="form1" runat="server">
    <div id="divMap">
    
    </div>
    </form>

Js:

[javascript] view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. <script type="text/javascript">  
  2.     var map = null;  
  3.     var bingMapKey = "AvHCAx5M3rKrzF-3b_DpRotDCe5Bs53FsqmGhg6i4t0ISDPjadyZsCke61VGacfd";  
  4.     var infobox = null;  
  5.   
  6.     $(document).ready(function ()  
  7.     {  
  8.         var mapOptions = {  
  9.             credentials: bingMapKey,  
  10.             enableClickableLogo: false,  
  11.             enableSearchLogo: false,  
  12.             showMapTypeSelector: true,  
  13.             showCopyright: false,  
  14.             mapTypeId: Microsoft.Maps.MapTypeId.road,  
  15.             //zoom: 10,  
  16.             //animate:false  
  17.             useInertia:false  
  18.         };  
  19.         map = new Microsoft.Maps.Map($('#divMap')[0], mapOptions);  
  20.   
  21.         var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(41, -72));  
  22.         // Add a handler to the pushpin drag  
  23.         Microsoft.Maps.Events.addHandler(pushpin, 'click', DisplayLoc);  
  24.         map.entities.push(pushpin);  
  25.   
  26.         //Infobox  
  27.         var infoboxOptions = {  
  28.             width: 300,  
  29.             height: 100,  
  30.             title: "Title1",  
  31.             description: "Description1",  
  32.             animate: false,  
  33.             showPointer: false  
  34.         };  
  35.         infobox = new Microsoft.Maps.Infobox(pushpin, infoboxOptions);  
  36.         map.entities.push(infobox);  
  37.   
  38.         var _chartLayer = new Microsoft.Maps.EntityCollection();  
  39.         map.entities.push(_chartLayer);  
  40.   
  41.     })  
  42. </script>  

版权声明:本文为skydxd原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。