javascript - 谷歌地图 API : Cannot read property '__e3_' of undefined

标签 javascript google-maps-api-3

这是我要添加的监听器 -

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 - 谷歌地图 API : Cannot read property '__e3_' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7058094/

相关文章:

javascript - 分数 slider 不工作

google-maps - Google map 嵌入 API 显示带有中心纬度的图钉

javascript - 使用 mvc 模型在 Google Maps API v3 上显示标记

javascript - 动态向数据库插入数据

javascript - 在 ember.js 中保存对象时出错 : 'Object X has no method ' save''

google-maps - 谷歌地图 : Dynamically Movable and Resizable Circle Overlay Script for v3

google-maps - 如何通过 "mid"参数从 Google Maps API 下载 KML 文件?

javascript - Google 放置 : Use multiple types

javascript - ASP.NET MVC 3 - Ajax 更新表 - 模型

javascript - 使用 e.keyCode || e.哪个;如何判断小写和大写的区别?