Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/469.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 google maps api 3带有2个标记_Javascript_Html_Google Maps Api 3 - Fatal编程技术网

Javascript google maps api 3带有2个标记

Javascript google maps api 3带有2个标记,javascript,html,google-maps-api-3,Javascript,Html,Google Maps Api 3,我正在使用google api v3中的以下代码来显示地图。 问题是因为我不擅长javascript,怎么可能在地图中显示第二个标记?(一个标记是我的位置,第二个标记是我的店铺?) 这是我使用的html代码。谢谢 <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equi

我正在使用google api v3中的以下代码来显示地图。 问题是因为我不擅长javascript,怎么可能在地图中显示第二个标记?(一个标记是我的位置,第二个标记是我的店铺?) 这是我使用的html代码。谢谢

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map-canvas { height: 100% }
    </style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
      function initialize() {
      var myLatlng = new google.maps.LatLng(51.215642,-2.615666);
        var myOptions = {
          zoom: 12,
          center: myLatlng,
          scaleControl: true,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
          var marker = new google.maps.Marker({
              position: myLatlng,
              map: map,
              title:"mytitle"
      });
        }
    </script>
  </head>
  <body onload="initialize()">
<div id="map_canvas" style="height:100%"></div>
  </body>
</html>

html{高度:100%}
正文{高度:100%;边距:0;填充:0}
#地图画布{高度:100%}
函数初始化(){
var mylatng=newgoogle.maps.LatLng(51.215642,-2.615666);
变量myOptions={
缩放:12,
中心:myLatlng,
scaleControl:对,
mapTypeId:google.maps.mapTypeId.ROADMAP
}
var map=new google.maps.map(document.getElementById(“map_canvas”),myOptions);
var marker=new google.maps.marker({
职位:myLatlng,
地图:地图,
标题:“我的标题”
});
}
我已经修复了。。 这是更改后的代码

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map-canvas { height: 100% }
    </style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
      function initialize() {
      var myLatlng = new google.maps.LatLng(38.078833, 23.737843);
     var storelng = new google.maps.LatLng(38.079576, 23.736706);
        var myOptions = {
          zoom: 18,
          center: myLatlng,
          scaleControl: true,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
          var marker = new google.maps.Marker({position: myLatlng, map: map,title:"mytitle"


      });


          var Marker = new google.maps.Marker({ position: storelng,map: map,title:"mytitle"
});

      }
    </script>
  </head>
  <body onload="initialize()">
<div id="map_canvas" style="height:100%"></div>
  </body>
</html>

html{高度:100%}
正文{高度:100%;边距:0;填充:0}
#地图画布{高度:100%}
函数初始化(){
var mylatng=new google.maps.LatLng(38.078833,23.737843);
var storelng=新的google.maps.LatLng(38.079576,23.736706);
变量myOptions={
缩放:18,
中心:myLatlng,
scaleControl:对,
mapTypeId:google.maps.mapTypeId.ROADMAP
}
var map=new google.maps.map(document.getElementById(“map_canvas”),myOptions);
var marker=new google.maps.marker({位置:MyAtlng,地图:map,标题:“mytitle”
});
var Marker=new google.maps.Marker({position:storelng,map:map,title:“mytitle”
});
}