//成都市的查找电影院的地图索引
1 <html> 2 <head> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 5 <style type="text/css"> 6 body, html {width: 100%;height: 100%;margin:0;font-family:"微软雅黑";} 7 #allmap{width:100%;height:500px;} 8 p{margin-left:5px; font-size:14px;} 9 </style> 10 <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Hsp8depzF33mk1v6L5uPORWPWiEjj5Rg"></script> 11 <title>根据关键字本地搜索</title> 12 </head> 13 <body> 14 <div id="allmap"></div> 15 <p>返回成都市“景点”关键字的检索结果,并展示在地图上</p> 16 </body> 17 </html> 18 <script type="text/javascript"> 19 // 百度地图API功能 20 var map = new BMap.Map("allmap"); 21 map.centerAndZoom(new BMap.Point(104.07 , 30.67), 11); 22 var local = new BMap.LocalSearch(map, { 23 renderOptions:{map: map} 24 }); 25 local.search("影院"); 26 map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用 27 map.enableContinuousZoom(); //启用地图惯性拖拽,默认禁用 28 </script>