我完全不知道为什么。这是我第一次尝试使用 Maps API v3 执行此操作。地图显示正确,但看不到任何标记。这是代码:
<script>
window.onload = function(evt) {
if(document.readyState === 'complete') {
var latlng = new google.maps.LatLng(50.833, 4.333);
var styles = [
{
stylers: [
{ hue: '#ffdd00' }
]
}
];
var myOptions = {
zoom: 16,
scrollwheel: false,
mapTypeControl: false,
disableDoubleClickZoom: true,
draggable: false,
navigationControl: false,
streetViewControl: false,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: styles
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var image = '/img/marker.png';
map.addMarker({
lat: 50.833,
lng: 4.333,
title: 'Here it is',
icon: image,
});
}
}
</script>
有任何想法吗?