首页 > 其他 > 详细

百度地图输入一个位置到另一个位置的路线

时间:2018-12-08 16:45:51      阅读:244      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5     <title>驾车途经点</title>
 6     <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
 7     <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak="></script>
 8 </head>
 9 <body>
10     <div class="message">
11         <input placeholder="起点" id="start" />
12         <input type="" name="end" id="end" value="" placeholder="终点" />
13         <button id="search">搜索</button>
14     </div>
15     <div id="container" style="height: 500px;;"></div>
16 </body>
17 </html>
18 <script>
19     var map = new BMap.Map("container");    
20     map.centerAndZoom(new BMap.Point(114.064552,22.548457), 11);    
21     var transit = new BMap.TransitRoute(map, {    
22         renderOptions: {map: map}    
23     });    
24     
25     $("#search").click(function(){
26         var start = $("#start").val();
27         var end = $("#end").val();
28     
29         transit.search(start, end);
30     });
31     
32 </script>

 

百度地图输入一个位置到另一个位置的路线

原文:https://www.cnblogs.com/xiuxiume/p/10087983.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!