【发布时间】:2011-08-14 16:29:19
【问题描述】:
这是我要添加的监听器 -
var map;
var geocoder;
function initialize() {
var myOptions = {
zoom: 8,
center: new google.maps.LatLng(22, 88),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
}
//google.maps.event.addDomListener(window, 'load', initialize);
google.maps.event.addListener(map, 'click', function(event) {
geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'latLng': event.latLng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
alert(results);
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
});
但它在控制台中生成此错误 -
Uncaught TypeError: Cannot read property '__e3_' of undefined
Ke
Ie
R.addListener
(anonymous function)
尝试搜索。但没有解决方案。
【问题讨论】:
-
你找到什么了吗?我有同样的问题
标签: javascript google-maps-api-3