<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.11&key=9de88a718781910c9a1c81230827d1ce&plugin=AMap.Driving,AMap.Autocomplete"></script> <title>高德地图案例——移动端请帖</title> <meta name="viewport" content="initial-scale=1.0,user-scaleble=no,width=device-width" /> <style> *{ padding: 0; margin: 0; } #container{ position: absolute; top: 10%; left: 0; width: 100%; height: 80%; } #panel{ position: fixed; background: white; top: 10px; right: 10px; width: 280px; } #search{ width: 100%; height: 10%; position: absolute; left: 0px; top: 0px; background: white; } body{ background: lightcoral; } </style> </head> <body> <div id="container"></div> <div id="search"> <input type="" id="ipt" /> <button id="btn">导航</button> </div> <!-- <div id="panel"></div> <div id="search"> 起点:<input type="text" name="" id="startNode"/><br /> 终点:<input type="text" name="" id="endNode"/><br /> <button id="btn">开始导航</button> </div> --> <script> var map = new AMap.Map(‘container‘,{ zoom:11, center:[116.379391,39.861536], }); new AMap.Autocomplete({ input:‘ipt‘ }) btn.onclick = function(){ new AMap.Driving({ map:map }).search([ {keyword:ipt.value,city:‘北京‘}, {keyword:‘天宫院‘,city:‘北京‘} ],function(status,data){ console.log(data); }) }; </script> </body> </html>