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/8/api/5.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 “我的谷歌地图”(v3)中未显示多个标记_Javascript_Api_Google Maps_Jakarta Ee_Google Maps Api 3 - Fatal编程技术网

Javascript “我的谷歌地图”(v3)中未显示多个标记

Javascript “我的谷歌地图”(v3)中未显示多个标记,javascript,api,google-maps,jakarta-ee,google-maps-api-3,Javascript,Api,Google Maps,Jakarta Ee,Google Maps Api 3,我开始开发一个web应用程序,并使用API Google Maps v3 但是在我的JSP页面中!我发现标记有点问题!我不知道为什么在我加载页面时它没有显示 var Reservoirs = [ ['Place 1', 30.430220, -9.624624], ['Place 2', 30.430254, -9.624254], ['Place 3', 30.430444, -9.624444], ['Place 4', 30.430550, -9.624555], ['Place 5',

我开始开发一个web应用程序,并使用API Google Maps v3 但是在我的JSP页面中!我发现标记有点问题!我不知道为什么在我加载页面时它没有显示

var Reservoirs = [
['Place 1', 30.430220, -9.624624],
['Place 2', 30.430254, -9.624254],
['Place 3', 30.430444, -9.624444],
['Place 4', 30.430550, -9.624555],
['Place 5', 30.430550, -9.624774]   

];



    function initialize() {
         var mapOptions = {  
                zoom: 17,
                center: new google.maps.LatLng(30.430220, -9.624624),
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                mapTypeControl: false
          };
         var map = new google.maps.Map(document.getElementById('map-canvas'),
                                    mapOptions);

         for (i = 0; i < Reservoirs.length; i++) {   

            createMarker(map, markers[i][1], markers[i][2],markers[i][1], markers[i][0]);
         }
        function createMarker(map, lat ,Lng , name) {
              var marker = new google.maps.Marker({
                position: new google.maps.LatLng(lat, Lng),
                map: map,
                title: name
              });
            }
var储层=[
[Place 1',30.430220,-9.624624],
[Place 2',30.430254,-9.624254],
[Place 3',30.430444,-9.624444],
[Place 4',30.430550,-9.624555],
[Place 5',30.430550,-9.624774]
];
函数初始化(){
var mapOptions={
缩放:17,
中心:新google.maps.LatLng(30.430220,-9.624624),
mapTypeId:google.maps.mapTypeId.ROADMAP,
mapTypeControl:false
};
var map=new google.maps.map(document.getElementById('map-canvas'),
地图选项);
对于(i=0;i<0.length;i++){
createMarker(地图、标记[i][1]、标记[i][2]、标记[i][1]、标记[i][0]);
}
功能createMarker(地图、纬度、液化天然气、名称){
var marker=new google.maps.marker({
位置:新google.maps.LatLng(lat,Lng),
地图:地图,
标题:姓名
});
}
要在我使用的页面上加载地图,请执行以下操作:

  <body onload="initialize()">
<div id="map-canvas"/>

那么!你觉得呢?问题出在哪里?
谢谢大家!您没有定义markers变量,所以请使用水库。此外,您的函数接收4个参数,而不是5个

 for (i = 0; i < Reservoirs.length; i++) {   
    createMarker(map, Reservoirs[i][1], Reservoirs[i][2], Reservoirs[i][0]);
 }
(i=0;i<0.length;i++)的

createMarker(地图,水库[i][1],水库[i][2],水库[i][0]);
}

您应该发布收到的错误。