2011-03-12 45 views
1

我知道如何嵌入一个公共GMAP:我可以试用一个公共GMap,然后通过编程修改它吗?

 <iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=207932289133051333830.000457f61fc6dcab1aff1&amp;ll=46.495556,11.359863&amp;spn=0.017726,0.025749&amp;z=14&amp;output=embed"></iframe> 

我也知道如何使用JavaScript创建和程序,我想一个。我试图做的是结合两种方法: 我嵌入公共gmap,但随后以编程方式修改它(或(更好)在它的顶部添加覆盖)。这可能吗?任何例子?

+0

你说的 “修改” 究竟是什么意思? – 2011-03-12 18:41:51

+0

相关:http://code.google.com/intl/zh-CN/apis/maps/documentation/javascript/demogallery.html – 2011-03-12 18:42:15

+0

相关:http://stackoverflow.com/questions/2199421/combine-google-maps -api-google-maps-data-api – simpatico 2011-03-12 19:13:26

回答

1

给它一个ID,然后你可以找到它并改变它。

<iframe id="MyFrame" width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=207932289133051333830.000457f61fc6dcab1aff1&amp;ll=46.495556,11.359863&amp;spn=0.017726,0.025749&amp;z=14&amp;output=embed"></iframe> 

然后使用:

document.getElementById("MyFrame") 

然后你就可以用一套setAttribute()

更多改变这个元素的属性:Change HTML class attribute using javascript

+0

但我该如何创建一个覆盖设置属性?基本上我需要改变一些特定的标记图标。 – simpatico 2011-03-12 18:55:51

0

你需要使用谷歌地图API添加标记。

查看Google Maps V3 API demo gallery中的custom marker example。代码太长,无法在此复制+粘贴,但它应该回答您的基本问题。

更多基本的东西,看一下将M aps API code samples.

+0

不,这不是。 http://gmaps-samples-v3.googlecode.com/svn/trunk/overlayview/custommarker.html – simpatico 2011-03-13 07:40:12

+0

@simpatico你能更详细地描述你想要什么吗? – 2011-03-13 09:15:13

相关问题