地图工作正常,但是当我尝试添加标记时它不起作用?
到目前为止,这是我的代码:
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"></script>
<script>
function initialize()
{var mapProp = {
center: new google.maps.LatLng(-33.975618,25.585858),
zoom:15,
panControl:true,
zoomControl:true,
mapTypeControl:true,
scaleControl:true,
streetViewControl:true,
overviewMapControl:true,
rotateControl:true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("column2linksmap2"),mapProp);
var marker = new google.maps.Marker({
position: latLng,
title:"Hello World!",
visible: true
});
marker.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>