我有愚蠢的问题,我无法使用GoogleMaps API添加标记。我差点从示例中复制脚本,但它不起作用
<script type="text/javascript">
$(function() {
initialize();
});
function initialize() {
var mapOptions = {
zoom : 6,
center : new google.maps.LatLng(-25.363882, 131.044922),
mapTypeId : google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
google.maps.event.addListener(map, 'click', function(e) {
placeMarker(e.latLng, map);
});
}
function placeMarker(position, map) {
var marker = new google.maps.Marker({
position : position,
map : map
});
map.panTo(position);
}
</script>
此代码有问题吗?