我正在使用此代码来生成谷歌地图使用谷歌地图API。 这是工作示例jsfiddle谷歌地图api不加载地图
js代码
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
function initialize() {
var myloc = new google.maps.LatLng(35.433820, -97.135620);
var mapOptions = {
zoom: 17,
topCenter: myloc,
scrollwheel: false
};
var map = new google.maps.Map(document.getElementById('map'),mapOptions);
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map,
animation: google.maps.Animation.BOUNCE
});
var contentString = '<div id="content" style="dir:rtl; text-align:right;">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading"><h1>title here</h1>'+
'<div id="bodyContent">'+
'<p>description here</p>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString,
maxWidth: 250
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
HTML代码
<div id="map"></div>
地图iframe是有,但映射为空,没有标记没有道路就在iframe
为什么这个标签[谷歌地图的API-2](http://stackoverflow.com/questions/tagged/google -maps-api-2),该版本的API自2010年5月19日起正式被弃用。 – geocodezip