Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.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
谷歌地图显示错误-https://developers.google.com/maps/documentation/javascript/error-messages#missing-键映射错误_Javascript_Google Maps_Google Maps Api 3 - Fatal编程技术网

谷歌地图显示错误-https://developers.google.com/maps/documentation/javascript/error-messages#missing-键映射错误

谷歌地图显示错误-https://developers.google.com/maps/documentation/javascript/error-messages#missing-键映射错误,javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,我想在谷歌地图中添加我的自定义图像,但页面未加载,错误为MissingKeyMapError。我想我必须添加身份验证密钥,但我无法添加身份验证密钥 <!DOCTYPE html> <html> <head> <script src="https://maps.googleapis.com/maps/api/js?key=xyzKey" type="text/javascript"></script> <scr

我想在谷歌地图中添加我的自定义图像,但页面未加载,错误为MissingKeyMapError。我想我必须添加身份验证密钥,但我无法添加身份验证密钥

<!DOCTYPE html>
<html>
<head>
    <script src="https://maps.googleapis.com/maps/api/js?key=xyzKey" type="text/javascript"></script>


    <script>

var myCenter = new google.maps.LatLng(22.8046, 86.2029);
function initialize()
{
var mapProp = {
  center:myCenter,
  zoom:14,
  mapTypeId:google.maps.MapTypeId.ROADMAP
  };

var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);

var marker=new google.maps.Marker({
  position:myCenter,
  icon:'dustbin3.png'
});


marker.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);
    </script>
</head>

<body>
    <div id="googleMap" style="width:1500px;height:880px;"></div>

</body>
</html>

var myCenter=newgoogle.maps.LatLng(22.8046,86.2029);
函数初始化()
{
var mapProp={
中心:迈森特,
缩放:14,
mapTypeId:google.maps.mapTypeId.ROADMAP
};
var map=new google.maps.map(document.getElementById(“googleMap”),mapProp);
var marker=new google.maps.marker({
职位:迈森特,
图标:'dustbin3.png'
});
marker.setMap(map);
}
google.maps.event.addDomListener(窗口“加载”,初始化);

在脚本url中添加api密钥

<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" type="text/javascript"></script>

参考号