【问题标题】:Uncaught TypeError: Cannot read property '__e3_' of undefined未捕获的类型错误:无法读取未定义的属性“__e3_”
【发布时间】:2013-02-21 17:11:14
【问题描述】:

我正在使用 VB.NET 和 Google Maps v3 开发应用程序,并尝试使用以下属性创建地图:

<script type="text/javascript"> 
    $(document).ready(function (){ 
        var sPath ="images/AppIcons/Vehicles/icon05.png,";
        var markers= new google.maps.Marker({
            position : new google.maps.LatLng(4.759915, -74.04083),
            map : map,
            icon : new google.maps.MarkerImage(+ sPath + null, null, null, new google.maps.Size(32, 32)),
            animation: google.maps.Animation.DROP,
            title : "buena"
        });
        var myLatlng = new google.maps.LatLng(0, 0);
        var mapOptions={zoom: 3,center: new google.maps.LatLng(4.590798,-74.084244),mapTypeId: google.maps.MapTypeId.ROADMAP };
        var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
        var marker = setMarkers(map);
        var infowindow = new google.maps.InfoWindow({Content : '<b>FM3200 - FM3200</b><div><font size=1>&nbsp;</font></div><div><u>20/01/2013 04:30:56 p.m. - Voltaje Externo - (Norte)</u></div>Ubicacion Invalida In1:0 In2:0 In3:0 Batext:4.45V Vel:0 Odom:0 Ibutton:0 Oficina Principal Risk, Kmh: 0'});
        if (markers !='') {
            google.maps.event.addListener(marker, 'click', function() {
                infowindow.open(map,marker);
                /*if (marker.getAnimation() != null) {
                    marker.setAnimation(null);
                } else {
                    marker.setAnimation(google.maps.Animation.BOUNCE);
                }*/
            });
        }
    });
    function setMarkers(map,markers) {
        var marker =markers;
        if (marker !='') {
            return marker;
        }
    }</script>

当我运行此代码时,出现以下错误消息:

Uncaught TypeError: Cannot read property '__e3_' of undefined main.js:18 

我该如何解决这个错误?

【问题讨论】:

标签: google-maps google-maps-api-3


【解决方案1】:

map 的创建移到函数顶部。

目前您使用map 作为markersmap-option,它应该是google.maps.Map-instance(但它未定义,因为尚未创建地图)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-23
    • 1970-01-01
    • 1970-01-01
    • 2021-12-22
    • 2015-01-06
    • 2017-07-26
    相关资源
    最近更新 更多