2014-06-12 95 views
-2

我不知道我是否在做一些愚蠢的事情,但我的谷歌地图不显示在这个测试页面。你能看到任何错误吗?Javascript。为什么Google地图不显示?

<!DOCTYPE html> 
<html> 
<head> 
    <title></title> 
    <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> 
    <script src="http://maps.google.com/maps/api/js?sensor=false"></script> 
    <script type="text/javascript" src="js/jquery.gomap-1.3.2.min.js"></script> 
    <script> 
     $(function() { 
      $("#map").goMap({ 
       latitude: 56.948813, 
       longitude: 24.104004, 
       zoom: 6 
      }); 
     }); 
    </script> 
    <style> 
     #map { 
      width:700px; 
      height:400px; 
     } 
    </style> 
</head> 
<body> 
<div id="map">map goes here</div> 
</body> 
</html> 
+0

尝试将'.js'放在您的链接到谷歌地图的末尾。 – theonlygusti

+0

所以应该是'src =“http://maps.google.com/maps/api/js?sensor=false.js” – theonlygusti

+2

@theonlygusti nope。 –

回答

2

我并不确定goMaps是什么,但直接使用google maps API非常简单。以下应该做你想要什么(不走地图):

$(function() { 
    var mapOptions = { 
     center: new google.maps.LatLng(56.948813, 24.104004), 
     zoom: 6 
    }; 

    var newMap = new google.maps.Map($("#map")[0], mapOptions); 
}); 

的jsfiddle - http://jsfiddle.net/4mRhB/3/

对谷歌地图的完整文档可以found here。祝你好运!

+0

谢谢。这工作。 – Tony

相关问题