【发布时间】:2012-08-19 02:58:54
【问题描述】:
我正在将我的 Google 多点地图从版本 2 移至版本 3。 我可以在单击时显示图标并打开新窗口,这很好,但在版本 2 中,当信息窗口打开时,有一个选项“到这里和从这里的路线”。当点击此处或从此处时,将出现一个文本字段,例如,您可以输入城镇名称。当点击按钮时,用户被发送到新窗口中的谷歌地图。 我似乎无法找到这样的选择。 这是我在第 2 版中的脚本:
// The info window version with the "to here" form open
to_htmls[i] = html + '<br>Directions: <b>To here</b> - <a href="javascript:fromhere(' + i + ')">From here</a>' +
'<br>Start address:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
'<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
'<INPUT value="Get Directions" TYPE="SUBMIT">' +
'<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() +
// "(" + name + ")" +
'"/>';
// The info window version with the "to here" form open
from_htmls[i] = html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here</a> - <b>From here</b>' +
'<br>End address:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
'<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +
'<INPUT value="Get Directions" TYPE="SUBMIT">' +
'<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
// "(" + name + ")" +
'"/>';
// The inactive version of the direction info
html = html + '<br><br>Directions: <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a>';
【问题讨论】:
-
您发布的代码都不是特定于 Google Maps API v2 的。您需要提供更多上下文或指向您尝试执行此操作但无法正常工作的地图(或 jsfiddle)的链接。
标签: google-maps google-maps-api-3