2012-01-31 16 views
2

私はv3のグーグルマップAPIを使用しますが、私は地図上のマーカーをクリックしたときに、私は次のエラー・メッセージを参照してください。GoogleマップV3 Infowindow.openエラー

b.K is not a function (72 out of range 43)

をここに私のコードです:

var marker = [];

var map;

var markerClusterer = null;

var load_ids = [];

var rectangle;

var infowindow = new google.maps.InfoWindow();

関数showAddress(XADDRESS、xzoom){

clearOverlays(); 
    $("#div_item_list").html(""); 
    $('#map_canvas2').gMap({ address: xaddress, zoom:xzoom, 
     onComplete: function() { 

      //marker from address 
      geocoder = new google.maps.Geocoder(); 
      geocoder.geocode({'address': xaddress}, function(results, status) { 
       if (status == google.maps.GeocoderStatus.OK) { 
        map.gMap('addMarker', { 
         key: 'mainMarker', 
         latitude: results[0].geometry.location.lat(), 
         longitude: results[0].geometry.location.lng(), 
         popup: true 
        }); >map_search(results[0].geometry.location.lat(),results[0].geometry.location.lng()); 
        map.data('gmap').gmap.setCenter(results[0].geometry.location); 
        //clearOverlays(); 
       } 
       else { 
        alert("Geocoder failed due to: " + status); 
       } 
      }); 
     } 
    }); 
    return false; 

}

関数clearOverlays(){

if (markers) { 
    for (i in markers) { 
    markers[i].setMap(null); 
    } 
} 
if(markerClusterer){ 
    markerClusterer.clearMarkers(); 
} 

}

関数map_search(緯度、経度){

スクリプト infowindow.open(map,marker);は、例えば

を実行したとき

}

関数createMarker(OBJECT_ID、マーカー、LAT、LNG、html_data){

var _gicon = { 
     image: 'images/item.png', 
     iconSize: new google.maps.Size(32, 32), 
     iconAnchor: new google.maps.Point(12, 46) 
    }; 
    gicon = new google.maps.MarkerImage(_gicon.image, _gicon.iconSize, null, _gicon.iconAnchor); 
    var latLng = new google.maps.LatLng(lat,lng); 
    var marker = new google.maps.Marker({ 
     'position': latLng, 
     'icon': gicon 
    }); 

    google.maps.event.addListener(marker, 'click', function(){ 
     infowindow.close(); 
     infowindow.setContent(html_data); 
     infowindow.open(map,marker); 
     //change screen 
     $('#point_show_'+object_id).addClass("ui-state-hover"); 
     $('#point_show_'+object_id).trigger("focus"); 
    }); 
    return marker;} 

エラーが思い付いたあなたが確認できhttp://cremp.solusi247.com/eways/en/search/map/index/、アドレステキストボックスにキーワード「Riyadh」を使用して検索する。 1つの家のアイコンをクリックします。

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script> 
<script type="text/javascript" src="infobox.js"></script> 

「BK」はちょうどあなたの情報ウィンドウの出力を難読化されています

+1

"infowindow"を作成する場所がわかりません –

+0

infowindow、mapはグローバル変数です。 –

+0

完全なコードを表示するか、フィドルを作成してください。 –

答えて

2

は、Googleが例えば、スクリプトタグをマップ後にhtmlページで「infobox.js」スクリプトタグが含まれていることを確認してください.openメソッド呼び出し。 GWT(Google Web Toolkit)を使用している場合、いくつかのデバッグ情報を表示するには、GWTコンパイルスタイルを「Pretty」または「Detailed」に設定します。公開時にのみ「難読化」スタイルを使用します。最終的なJavaScriptの構文エラーをキャッチするためにデバッグ中

try { 
    ... 
} catch(ex) { 
    alert(ex.message); 
} 

:またにあなたのコードを囲むことを忘れないでください。