1

我正在编写一个新的(wordpress)网站,并且有一个“联系人”菜单项。在这个菜单项中,我得到了一张地图(Google Maps iframe 的代码)。现在我应该在地图下有一个路线规划器。为此,我得到了一些代码:

<form name="search_route" method="get" action="http://maps.google.com/" target="_blank">
        <input name="saddr" type="text" id="saddr">
        <input name="daddr" type="hidden" id="daddr" value="Empire State Building, 350 5th Avenue, New York, NY, USA">
        <input type="submit" name="Submit" value="Submit">
    </form>

我的问题:代码正在运行,但它链接到maps.google.com我告诉表单的内容。但是路线应该计划在iframe我在页面上得到的而不是打开另一个链接。这可能吗?如果是的话,有人可以给我一个提示吗?

提前致谢

干杯

4

1 回答 1

4

示例代码:

<form method="get" action="https://www.google.com/maps" target="mapframe">
        <input name="saddr" type="text" id="saddr">
        <input name="output" type="hidden" value="embed">
        <input name="f" type="hidden" value="d">
        <input name="z" type="hidden" value="11">
        <input name="daddr" type="hidden" id="daddr" 
               value="Empire State Building, 350 5th Avenue, New York, NY, USA">
        <input type="submit" name="Submit" value="Submit">
</form>
<iframe 
  name="mapframe" width="425" height="350" 
  src="https://www.google.com/maps?z=11&amp;f=d&amp;output=embed&amp;ll=40.7902,-73.9597">
</iframe>

action形式的必须是形式的https://www.google.com/maps
必须target等于nameiframe

为通过嵌入代码的 iframe-src 获得的每个参数添加隐藏输入(至少需要一个字段output:embed

演示:http: //jsfiddle.net/doktormolle/3JsuM/

于 2013-09-08T20:53:02.877 回答