2012-09-12 57 views
0

当我点击我的超链接时,我无法访问Google Maps API v3以放大/缩小。我已经在这工作V2:单击超链接时,如何使用Google Maps API v3缩放地图?

<a href="javascript:map.setCenter(new GLatLng(58.37,62.66), 16);map.setMapType(G_SATELLITE_MAP);" >Some Place</a> 

在v3中我曾尝试:

<a href="javascript:map.setCenter(new google.maps.LatLng(58.37,62.66));">Some Place</a> 

我怎样才能解决这个问题?

回答

2

在v3中,你必须调用setZoom还有:

<a href="javascript:map.setCenter(new google.maps.LatLng(58.37,62.66));map.setZoom(16);">Some Place</a> 
+0

感谢。但是 错误:TypeError:map.setCenter不是函数 源文件:javascript:map.setCenter(new%20google.maps.LatLng(58.37,62.66)); map.setZoom(16); 行:1 – user1664349

+0

然后在你没有发布的代码中有错误。还要确保你的“地图”变量是全局定义的。 –

相关问题