如何在网站的iframe上获取Google地图路线规划工具 [英] How to get Google Maps route planner on website's iframe
问题描述
我正在编写一个新的(wordpress)网站,并且有一个联系人菜单项。在这个菜单项中,我获得了一张地图(由Google Maps iframe编码)。现在我应该在地图下面有一个路线规划师。为此,我得到了一些代码:
< form name =search_routemethod =getaction =http: //maps.google.com/target =_ blank>
< input name =saddrtype =textid =saddr>
< input name =daddrtype =hiddenid =daddrvalue =帝国大厦,美国纽约州纽约第五大道350号>
< input type =submitname =Submitvalue =Submit>
< / form>
我的问题:代码正在工作,但链接到 maps.google .com
就像我告诉表格。但是路线应该计划在页面上显示的 iframe
上,而不是打开另一个链接。这可能吗?如果是的话,有人可以给我一个提示吗?
提前致谢
干杯
示例代码:
< form method =getaction =https://www.google.com/mapstarget =mapframe>
< input name =saddrtype =textid =saddr>
< input name =outputtype =hiddenvalue =embed>
< input name =ftype =hiddenvalue =d>
< input name =ztype =hiddenvalue =11>
< input name =daddrtype =hiddenid =daddr
value =美国纽约州纽约第五大道350号帝国大厦>
< input type =submitname =Submitvalue =Submit>
< / form>
name =mapframewidth =425height =350
src =https://www.google.com/maps?z=11& ; F = d&放大器;放大器;输出=嵌入&放大器;放大器; 11 = 40.7902,-73.9597\" >
< / iframe>
表单的操作
必须是 https://www.google.com/maps
表单中的目标
等于 iframe的
名称
为通过嵌入代码的iframe-src获得的每个参数添加隐藏的输入(至少需要一个输出的字段:embed
)
演示: http://jsfiddle.net/doktormolle/ 3JsuM /
I'm programming a new (wordpress) website and there is a "Contact" menu item. In this menu item I got a map (code by Google Maps iframe). Now I should have a route planner under the map. For this I got a little code:
<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>
My problem: The code is working, but it links to maps.google.com
like I told the form. But the route should plan on the iframe
I got on the page and not open another link. Is this possible? If yes, can someone give me a hint?
Thanks in advance
Cheers
Sample-code:
<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&f=d&output=embed&ll=40.7902,-73.9597">
</iframe>
The action
of the form has to be https://www.google.com/maps
The target
of the form has to be equal to the name
of the iframe
Add hidden inputs to the form for each parameter you got via the iframe-src of the embed-code(at least a field for output:embed
is required)
Demo: http://jsfiddle.net/doktormolle/3JsuM/
这篇关于如何在网站的iframe上获取Google地图路线规划工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!