2012-08-23 34 views
1

我正在将我的Google多点地图从版本2移动到3. 我可以在点击时显示图标并打开新窗口,这很好,但在版本2时信息窗口打开有一个选项“方向到这里和从这里”。当到达这里或从这里点击时,会出现一个文本字段,您可以输入城镇的名称。当点击按钮时,用户被发送到Google地图上的一个新窗口。 我似乎无法找到这样的选项。 这里是脚本我有2版本:如何在infowindow中添加一个简单的方向

// 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>'; 
+1

您发布的代码都不是Google Maps API v2特有的。你需要提供更多的上下文或链接到你的地图(或jsfiddle),你试图做到这一点,并不能得到它的工作。 – geocodezip

回答

相关问题