2
지난 밤에 업데이트 할 때까지이 코드가 작동했습니다.
코드가 내 localhost에서 완벽하게 작동하지만 테스트 서버에서 오류가 발생합니다. Firebug의 오류 메시지는 "map.set_center is not a function"
입니다."map.set_center is not 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);
}
}
);
}
}
그게 전부입니다. 감사! – Steven
여러분을 환영합니다 :-) 재미있게 보내십시오! –