Get latitude/longitude coordinates from a Google map using a marker

后端 未结 5 1804
梦如初夏
梦如初夏 2020-12-24 07:54

I just wondered if anyone knew of a simple script available that will do the following:

Load a google map in view, when clicked it displays a marker that will save t

5条回答
  •  天涯浪人
    2020-12-24 08:49

    // add a click event handler to the map object
        GEvent.addListener(map, "click", function(overlay, latLng)
        {
            // display the lat/lng in your form's lat/lng fields
            document.getElementById("latFld").value = latLng.lat();
            document.getElementById("lngFld").value = latLng.lng();
        });
    

    I thinks when you will get the lat-lng then you can place marker.

提交回复
热议问题