Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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谷歌地图API_Javascript_Html_Google Maps_Google Maps Markers - Fatal编程技术网

声明标记Javascript谷歌地图API

声明标记Javascript谷歌地图API,javascript,html,google-maps,google-maps-markers,Javascript,Html,Google Maps,Google Maps Markers,我一直在为一个诡计宣布这样的标记: var marker=new google.maps.marker({ 但我需要用另一种方式,比如: var marker=new google.maps.marker({ 有什么方法可以很容易地做到这一点:)位置必须是一个LatLng对象,因此,如果要使用第二种方法,则需要如下操作: var marker = new google.maps.Marker({ position: new google.maps.LatLng(-25.363882,1

我一直在为一个诡计宣布这样的标记:

var marker=new google.maps.marker({

但我需要用另一种方式,比如:

var marker=new google.maps.marker({


有什么方法可以很容易地做到这一点:)

位置必须是一个LatLng对象,因此,如果要使用第二种方法,则需要如下操作:

var marker = new google.maps.Marker({

    position: new google.maps.LatLng(-25.363882,131.044922),

    map: map,

    title: 'XXXxx (xcv)'

});
    position: (-25.363882,131.044922),

    map: map,

    title: 'XXXxx (xcv)'

});
var marker = new google.maps.Marker({

    position: new google.maps.LatLng(-25.363882,131.044922),

    map: map,

    title: 'XXXxx (xcv)'

});