获取路线表单(Google 地图)

Avatar of Chris Coyier
Chris Coyier
<form action="http://maps.google.com/maps" method="get" target="_blank">
   <label for="saddr">Enter your location</label>
   <input type="text" name="saddr" />
   <input type="hidden" name="daddr" value="350 5th Ave New York, NY 10018 (Empire State Building)" />
   <input type="submit" value="Get directions" />
</form>

saddr = 用于输入起点地址的空白输入框
daddr = 硬编码的终点地址

输入地址并按下按钮,将打开包含路线信息的弹出窗口。不输入地址,只会打开终点地址的地图。

实时演示