Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在我的网站上显示多张地图,但 API 仅在地图容器的 ID 为“google_map”时才有效。我不能使用任何其他 ID。 有任何想法吗?谢谢
创建地图对象时
var map = new google.maps.Map(document.getElementById("map_canvas"))
挂钩到对应的div
<div id="map_canvas"></div>
您可以根据需要创建任意数量的地图对象:
var mapTwo = new google.maps.Map(document.getElementById("map_canvas_two"))
<div id="map_canvas_two"></div>