-1
One marker works great.I added a second marker but it does not appear。如何標記兩個地圖中的兩個不同位置是同一頁?
哪裏是我的代碼錯誤?我相信這很簡單,但它不起作用。
的Javascript
<script type="text/javascript">
function initialize() {
var mapOptions = {
zoom: 15,
center: new google.maps.LatLng(-12.99379, -38.52661),
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var mapOptions2 = {
zoom: 15,
center: new google.maps.LatLng(-12.994898, -38.470841),
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById('location-canvas'),
mapOptions);
var map2 = new google.maps.Map(document.getElementById('location-canvas2'),
mapOptions2);
var marker = new google.maps.Marker({
map: map,
draggable: false,
position: new google.maps.LatLng(-12.99379, -38.52661)
});
var marker2 = new google.maps.Marker({
map: map,
draggable: false,
position: new google.maps.LatLng(-12.994898, -38.470841)
});
}
google.maps.event.addDomListener(window, 'resize', initialize);
google.maps.event.addDomListener(window, 'load', initialize);
</script>
HTML
<div id='location-canvas' style='width:100%;height:200px;'></div>
<div id='location-canvas2' style='width:100%;height:200px;'></div>
不會出現在哪裏?你將它放在第一張地圖上,而不是放在map2上。 – geocodezip