创建href,以打开具有特定地址的Google地图 [英] Make a href which open a Google map with specific address

查看:59
本文介绍了创建href,以打开具有特定地址的Google地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个可变地址-myAddress

Suppose I have a variable address - myAddress

我想创建一个-<a href="..."></a>

这将打开带有该地址的Google Map.

which will open a Google Map with this address .

如何实现?

推荐答案

您可以这样做:

这是您的href: http://maps.google.com/?q= q之后的所有内容都将填充并提交搜索,例如: 哥伦比亚特区华盛顿,宾夕法尼亚大道1200号,20003

this is your href: http://maps.google.com/?q= everything that goes after q will be filled in the search filled and submitted, for example: 1200 Pennsylvania Ave SE, Washington, District of Columbia, 20003

所以链接看起来像这样:<a href="http://maps.google.com/?q=1200 Pennsylvania Ave SE, Washington, District of Columbia, 20003">...</a>

So the link looks like this: <a href="http://maps.google.com/?q=1200 Pennsylvania Ave SE, Washington, District of Columbia, 20003">...</a>

如果您需要动态地添加"q",则可以使用简单的jQuery代码来更新自己的href.

If you need the "q" to be dynamic you can do it with simple jQuery code to update your href.

这篇关于创建href,以打开具有特定地址的Google地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆