"
1 <!DOCTYPE html
2 [/span>html
3 [/span>head
4 [/span>meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />
5 [/span>title
6 [/span>script src=""""
7 [/span>script type=""text/javascript"" src=""""
8
, 0, 255, 1)""]9 [/span>body
10 [/span>div class=""message""
11 [/span>input placeholder=""起点"" id=""start"" />
12 [/span>input type="""" name=""end"" id=""end"" value="""" placeholder=""终点"" />
13 [/span>button id=""search""
14
15 [/span>div id=""container"" style=""height: 500px;;""
16
17
18 [/span>script
19 var map = new BMap.Map(""container"");
20 //代码效果参考:https://v.youku.com/v_show/id_XNjQwNTgzNDgxMg==.html
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
"