我被赋予了将我们的 API 调用从 v2 更新到 v3 的任务,这是它正在呈现的代码。然而返回的谷歌地图只是一个空白空间,所以很明显我做错了什么。
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=fakekey&sensor=false"></script>
<script type="text/javascript">
function onLoad(xLat,yLong,strAddress,mapname) {
var map = new google.maps.Map(document.getElementById(mapname));
//map.addControl(new GMapTypeControl());
alert(xLat);
var initialLocation = new google.maps.LatLng(xLat,yLong);
var point = new google.maps.Point(xLat,yLong);
// Create a marker whose info window displays the given number.
function createMarker(point, number, strMessage) {
var marker = new google.maps.Marker(point);
// Show this marker's index in the info window when it is clicked.
google.maps.event.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(strMessage);
});
return marker;
}
var marker = createMarker(point, 1, strAddress);
marker.setMap(map);
}
</script>