2017-10-04 5 views
-1

내가이 코드에 "간단한 마커"를 추가 할 gmaps ..하지만 난 그렇게 간단한 마크

이 자바 스크립트

에 대해 혼동하고있는 코드입니다 :

<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> 

답변

1

이 참조 : Adding a marker to GMaps (google maps)

Btw은

,이

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

을 시도하거나 oficcial 문서를 읽을 수 있습니다 :을

+0

예기치 않은 식별자 - 작동하지 않음 : '( –