2013-02-21 7 views
12

の「__e3_」私はVB.NETとGoogle Maps V3を使用してアプリケーションを開発し、これらのプロパティを持つマップを作成しようとしている:キャッチされない例外TypeError:プロパティを読み取ることができません未定義

<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 

どうすればこのエラーを解決できますか?

+0

あなたの関数setMarkers()google.maps.Map -instanceことが期待だmarkersためmap -optionとしてmapを使用します適切なマーカーオブジェクト。 – Marcelo

+0

おそらく、readyイベントではなく[onload event](http://stackoverflow.com/questions/3698200/window-onload-vs-document-ready)を使用してください – geocodezip

答えて

15

mapの作成を関数の先頭に移動します。

現在、あなたは作成されません(マップはまだ作成されていないので、それは、未定義です)

関連する問題