2013-03-28 56 views
0

我的項目是一個JQM,在信息窗口出現只在項目一次。當我移動到另一頁面並返回到地圖頁面時,infowindow處於死亡狀態。如何恢復它。如何清除gmaps信息窗口

firstmap = new google.maps.Map(document.getElementById("map"), myOptions); 

      var latlng = new google.maps.LatLng(Lat, Long); 
      geocoder.geocode({'latLng': latlng}, function(results, status) { 
       if (status == google.maps.GeocoderStatus.OK) { 
       if (results[1]) { 

        firstmap.setZoom(10); 
        marker = new google.maps.Marker({ 
         icon:image, 
         position: latlng, 
         map: firstmap 
        }); 

        infowindow.setContent(results[1].formatted_address); 
        infowindow.open(map, marker); 
       google.maps.event.addListener(marker, 'click', clearWindow); 

       } 
       } else { 
       alert("Geocoding failed to this location " + status); 
       } 
      }); 
    } 

function clearWindow() { 

    if (infowindow) { 
     google.maps.event.clearInstanceListeners(infowindow); 
     infowindow = null; 
    } 
    infowindow = new google.maps.InfoWindow(); 
    } 

我需要清除infowindow中的數據。建議我的一些想法

+0

是否要關閉信息窗口,或者只是想清除裏面的內容? – 2013-03-28 06:50:18

+0

@DeadMan嗨,只是我需要清除內容。 – 2013-03-28 06:51:03

回答

2

然後,只需用空白代替它裏面的內容:

infowindow.setContent(''); 
+0

讓我查一下我的工作 – 2013-03-28 06:54:31

+0

無它並沒有顯示內容信息窗口的第二次 – 2013-03-28 06:58:32

+0

意味着什麼。實際發生了什麼以及你想實現什麼。 – 2013-03-28 06:59:24