我下面的谷歌地圖API,並添加以下代碼,但不顯示標記谷歌地圖標記不顯示爲什麼?
function initialize() {
var myLatlng = new google.maps.LatLng(27.7000, 85.3333);
var map_canvas = document.getElementById('map_canvas');
var map_options = {
center: new google.maps.LatLng(27.7000, 85.3333),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
// To add the marker to the map, use the 'map' property
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Hello World!"
});
// To add the marker to the map, call setMap();
marker.setMap(map);
var map = new google.maps.Map(map_canvas, map_options)
}
google.maps.event.addDomListener(window, 'load', initialize);
你的HTML/css看起來像什麼?你的map_canvas div有多大?任何JavaScript錯誤? – geocodezip
100%寬度和400px高度貼圖顯示,但不是標記 –