• 努力使我的SetaCenter发挥作用,但不是。
该守则是:
$("#searchclick").click(function(){
var address = document.getElementById( searchbar ).value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { address : address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude2 = results[0].geometry.location.lat();
var longitude2 = results[0].geometry.location.lng();
var relocate = ("(" + latitude2 + ", " + longitude2 + ")");
alert("setting the center to: " + relocate);
map.setCenter(relocate);
} //when status is OK
}); // geocode
});
B. 警示正确返回 缩略语 The Centre to: (40.7143528, -74.0059731)
but its not making the center of the map the correct point...
任何想法为什么?