当前使用此 Javascript -
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script language='javascript'>
window.onload = function() {
var latlng = new google.maps.LatLng(<?php echo $lat; ?>, <?php echo $long; ?>);
var map = new google.maps.Map(document.getElementById('map'), {
center: latlng,
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: 'Set lat/lon values for this property',
draggable: true
});
google.maps.event.addListener(marker, 'dragend', function(a) {
console.log(a);
document.getElementById("Latitude").value = this.getPosition().lat();
document.getElementById("Longitude").value = this.getPosition().lng();
});
};
</script>
它工作正常,但我希望地图位置在纬度和经度值改变时改变。