我遇到了谷歌地图的奇怪行为(见附图)有人知道这是怎么回事吗?以前有人经历过吗?
下面的代码
<script>
<!--
var map_geolocation;
function savePosition_geolocation(point)
{
var input = document.getElementById("id_geolocation");
input.value = point.lat().toFixed(6) + "," + point.lng().toFixed(6);
map_geolocation.panTo(point);
}
function load_geolocation() {
var point = new google.maps.LatLng(50.728632, 9.111587);
var options = {
zoom: 13,
center: point,
mapTypeId: google.maps.MapTypeId.ROADMAP
// mapTypeControl: true,
// navigationControl: true
};
map_geolocation = new google.maps.Map(document.getElementById("map_geolocation"), options);
var marker = new google.maps.Marker({
map: map_geolocation,
position: new google.maps.LatLng(50.728632, 9.111587),
draggable: true
});
google.maps.event.addListener(marker, 'dragend', function(mouseEvent) {
savePosition_geolocation(mouseEvent.latLng);
});
google.maps.event.addListener(map_geolocation, 'click', function(mouseEvent){
marker.setPosition(mouseEvent.latLng);
savePosition_geolocation(mouseEvent.latLng);
});
}
$(function() {
load_geolocation();
});
//-->
</script>
<input type="hidden" name="geolocation" value="50.728632,9.111587" id="id_geolocation" /><div id="map_geolocation" style="width: 400px; height: 300px"></div>