Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/425.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌地图没有显示在HTML页面上_Javascript_Jquery_Google Maps_Google Maps Api 3 - Fatal编程技术网

Javascript 谷歌地图没有显示在HTML页面上

Javascript 谷歌地图没有显示在HTML页面上,javascript,jquery,google-maps,google-maps-api-3,Javascript,Jquery,Google Maps,Google Maps Api 3,我使用GMaps在html页面上显示地图,但它在页面上给出了这个错误 哎呀!出了点问题 此页面未正确加载Google地图。有关技术详细信息,请参阅JavaScript控制台 以及控制台中的这些错误 编辑:我已经生成了API密钥并将其添加到URL,现在我只得到了这个错误 未捕获的TypeError:无法读取未定义的属性“prototype” 我还检查了此线程: 我试着把我自己的代码片段放在那里,但我也犯了同样的错误 这是我的密码 HTML JS,包括 <script type="

我使用GMaps在html页面上显示地图,但它在页面上给出了这个错误

哎呀!出了点问题

此页面未正确加载Google地图。有关技术详细信息,请参阅JavaScript控制台

以及控制台中的这些错误

编辑:我已经生成了API密钥并将其添加到URL,现在我只得到了这个错误

未捕获的TypeError:无法读取未定义的属性“prototype”

我还检查了此线程:

我试着把我自己的代码片段放在那里,但我也犯了同样的错误

这是我的密码

HTML


JS,包括

<script type="text/javascript" src="//maps.google.com/maps/api/js?key=AIzaSyDPN1LpoBuDzlvGox2qcREeDCnKu-hsGs4"></script>
<script type="text/javascript" src="assets/plugins/gmaps.js"></script>
<script type="text/javascript">

jQuery(document).ready(function(){

    /**
     @BASIC GOOGLE MAP
     **/
    var map2 = new GMaps({
        div: "#map_canvas",
        lat: -12.043333,
        lng: -77.028333,
        scrollwheel: false
    });

    var marker = map2.addMarker({
        lat: -12.043333,
        lng: -77.028333,
        title: "Company, Inc."
    });

});

</script>

jQuery(文档).ready(函数(){
/**
@基本谷歌地图
**/
var map2=新的全球海洋环境管理计划({
分区:“#地图#画布”,
纬度:-12.043333,
液化天然气:-77.028333,
滚轮:错误
});
var marker=map2.addMarker({
纬度:-12.043333,
液化天然气:-77.028333,
标题:“公司,股份有限公司”
});
});

尝试在此处获取API密钥(需要Google帐户):

有关更多信息:


您是否阅读了它在控制台中提供给您的链接?因此您没有api密钥。获取API密钥我生成了API并在URL中使用了它,但我仍然收到此错误
未捕获类型错误:无法读取未定义的属性“prototype”
您的代码未显示API密钥。。因为误差不同,并不意味着前面的问题已经解决。请同时更新您的代码。很抱歉,我忘了包含它。现在检查一下。API键就在那里。我假设您正确地遵循了示例,您的
gmaps.js
文件链接正确,等等。我不确定原型错误的来源,但我建议查看此页面的源代码,并将其作为您的起点:我正是在使用它。错误来自
http://maps.google.com/maps-api-v3/api/js/25/8/common.js
<script type="text/javascript" src="//maps.google.com/maps/api/js?key=AIzaSyDPN1LpoBuDzlvGox2qcREeDCnKu-hsGs4"></script>
<script type="text/javascript" src="assets/plugins/gmaps.js"></script>
<script type="text/javascript">

jQuery(document).ready(function(){

    /**
     @BASIC GOOGLE MAP
     **/
    var map2 = new GMaps({
        div: "#map_canvas",
        lat: -12.043333,
        lng: -77.028333,
        scrollwheel: false
    });

    var marker = map2.addMarker({
        lat: -12.043333,
        lng: -77.028333,
        title: "Company, Inc."
    });

});

</script>