Google Maps API v3 MapTypeId作为变量 [英] Google Maps API v3 MapTypeId as variable
本文介绍了Google Maps API v3 MapTypeId作为变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
设置Google地图类型时:
When setting the google map type:
map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
我可以用包含字符串TERRAIN,SATELLITE的js变量替换TERRAIN
Can I replace "TERRAIN" by a js variable containing the string "TERRAIN", "SATELLITE", etc?
推荐答案
是的,像这样调用它:
Yes, call it like this:
var mapType = "TERRAIN";
map.setMapTypeId(google.maps.MapTypeId[mapType]);
这篇关于Google Maps API v3 MapTypeId作为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文