谷歌地图不适用于OpenShift

时间:2016-02-12 11:19:07

标签: google-maps openshift

我在我的网站上使用Google Map API。当我在本地主机上运行我的网站时,谷歌地图运作良好,但当我在OpenShift上部署我的网页时,谷歌地图不起作用?我使用带有Tomcat的java web

我的索引

<html>
<head>
    <meta http-equiv="content-type" content="text/html" />
    <meta name="author" content="lolkittens" />
    <meta charset="utf-8" />
    <script src="http://maps.googleapis.com/maps/api/js"></script>
    <script src="GoogleMapAPI.js" type="text/javascript" charset="utf-8"></script>
    <title>Untitled 2</title>
</head>

<body>
    <div id="googleMap" style="width:500px;height:380px;"></div>
</body>
</html>

我的js文件:

function initialize() 
{
    var myCenter=new google.maps.LatLng(10.771400, 106.685844);
    var mapProp = 
    {
        center:myCenter,
        zoom:17,
        mapTypeId:google.maps.MapTypeId.ROADMAP
    };
    var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
    var marker=new google.maps.Marker(
    {
      position:myCenter,
      animation:google.maps.Animation.BOUNCE
    });

    marker.setMap(map);
    var infowindow = new google.maps.InfoWindow(
    {
      content:"NHP Shop <br/> 274/9 Võ Văn Tần P5, Q3"
    });
    //add sự kiện onclick vào google map marker
    /*google.maps.event.addListener(marker, 'click', function() 
    {
      infowindow.open(map,marker);
    });*/
    infowindow.open(map,marker);
}
google.maps.event.addDomListener(window, 'load', initialize);

那么请告诉我我的代码有什么问题?非常感谢

0 个答案:

没有答案
相关问题