为什么我得到"map.set_center不是函数"?

Ste*_*ven 2 javascript google-maps geocoding google-maps-api-3

这段代码一直有效,直到我昨晚更新.
代码在我的localhost上完美运行,但是我的测试服务器上出现错误.错误消息(来自Firebug)是"map.set_center is not a function".

那为什么这不再适用于我的服务器呢?

  function googleMapInit() 
  {    
    if (jQuery('#map_canvas').length > 0) {
      var currentLocation    = jQuery('#geomap_ddlCity :selected').text() + ', ' + jQuery('#geomap_ddlCountry :selected').text();
      var options   = {zoom: 14, mapTypeId: google.maps.MapTypeId.ROADMAP }
      var map       = new google.maps.Map(document.getElementById("map_canvas"), options);
      var geocoder  = new google.maps.Geocoder();

      //Center map for current selected city
      geocoder.geocode(    
      { 
        address: currentLocation}, function(results, status)
        {
            if (status == google.maps.GeocoderStatus.OK && results.length) {
                alert(results[0].geometry.location);
                map.set_center(results[0].geometry.location);
            } else 
            {
                var oslo = new google.maps.LatLng(59.9167, 10.75);
                map.set_center(oslo);
            } 
        }
      );  
    }
  }
Run Code Online (Sandbox Code Playgroud)

Pas*_*TIN 5

似乎Map类中没有set_center方法; 你应该使用,而不是.setCenter