0
我剛剛開始使用Goggle Maps API,並且已按照所有說明進行操作,但由於某些原因,地圖顯示但顯示標記以顯示特定位置。Google Maps API標記不顯示
下面是代碼我使用:
function initialize() {
var map_canvas = document.getElementById('map_canvas');
var myLatIng = new google.maps.LatLng(-1.288902, 36.806304);
var map_options = {
center: myLatIng,
zoom: 19
}
var map = new google.maps.Map(map_canvas, map_options);
var contentString = '<h2>Capacity Development Institute</h2><p>NAS Apartments, Milimani Road,<br>P.O.Box 33411 - 00600, Nairobi, Kenya</p>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Capacity Development Institute'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
我究竟在做什麼錯?
感謝
你應該看看你的瀏覽器的控制檯,你可能會看到錯誤... – AlexB