我想在一个网页中放置多个谷歌地图我正在使用 google map api v3 加载谷歌地图,我在网页中制作了单个地图,但我想在不同位置放置多个谷歌地图
这是代码:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Dynamic Loading</title>
<script type="text/javascript">
function handleApiReady() {
var myLatlng = new google.maps.LatLng(23.038587, 72.478253);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map1 = new google.maps.Map(document.getElementById("map_canvas1"),
myOptions);
var map2 = new google.maps.Map(document.getElementById("map_canvas2"),
myOptions);
}
</script>
</head>
<body style="margin:0px; padding:0px;">
<div id="map_canvas1" style="width:400px; height:400px"></div>
<div id="map_canvas2" style="width:400px; height:400px"></div>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false&callback=handleApiReady
"></script>
</body>
</html>