【问题标题】:simple mark gmaps简单的标记 gmap
【发布时间】:2017-10-04 10:51:03
【问题描述】:

我想在这段代码上添加“简单标记”.. 但我对 javascript 很困惑

这是代码:

<script type="text/javascript">
                    map = new GMap2(document.getElementById("mapa"));
                    map.addControl(new GLargeMapControl());
                    map.addControl(new GMapTypeControl(3));
                    map.setCenter( new GLatLng(-7.263372623252126, 112.75139808654785), 14,0);

                    GEvent.addListener(map,'mousemove',function(point)
                    {
                        document.getElementById('latspan').innerHTML = point.lat()
                        document.getElementById('lngspan').innerHTML = point.lng()  
                        document.getElementById('latlong').innerHTML = point.lat() + ', ' + point.lng()

                    });

                    GEvent.addListener(map,'click',function(overlay,point)
                    {
                        document.getElementById('latlongclicked').value = point.lat() + ', ' + point.lng()

                    });
                </script>

【问题讨论】:

    标签: javascript google-maps marker


    【解决方案1】:

    参考这个:Adding a marker to GMaps (google maps)

    顺便说一句,你可以试试这个

    map.addMarker({
      lat: -12.043333,
      lng: -77.028333,
      title: 'Lima',
      click: function(e) {
        alert('You clicked in this marker');
      }
    });
    

    或阅读官方文档:https://developers.google.com/maps/documentation/javascript/examples/marker-simple?hl=es-419

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-02
      • 1970-01-01
      • 2013-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-22
      相关资源
      最近更新 更多