2011-09-15 3 views
0

infoWindows가있는 Google지도에 여러 핀이 표시되어 있으며 html 페이지에 위치 이름이 표시되어 있습니다. 이제는 위치 이름을 클릭 할 때 핀이 필요합니다. 하나에서 다른 것으로, 정보창을 보여줘야합니다.
그래서 해결책이 있습니까? 여기 http://i53.tinypic.com/hvec15.jpg

헤이 난 구글 map_lib와 함께 그것을 가지고한 핀에서 다른 핀으로 이동하는 방법

function initialize() { 


if (GBrowserIsCompatible()) { 
    var map = new GMap2(document.getElementById("map_canvas")); 
    map.addControl(new GSmallMapControl()); 
    map.setCenter(new GLatLng(51.50015, -0.12624), 13); 

// Creates a marker at the given point 
// Clicking the marker will hide it 
var marker = new GMarker(new GLatLng(lat, longt)); 
    map.addOverlay(marker); 
function createMarker(latlng, number) { 
    var marker = new GMarker(latlng); 
    marker.value = number; 
    GEvent.addListener(marker,"click", function() { 
    var myHtml = number + ""; 
    map.openInfoWindowHtml(latlng, myHtml); 
    }); 
    return marker; 
} 

// Add 5 markers to the map at random locations 
// Note that we don't add the secret message to the marker's instance data 
var bounds = map.getBounds(); 
for (index in markers){ 
var n=markers[index]; 
    var latlng = new GLatLng(n.lat,n.lng); 
map.addOverlay(createMarker(latlng, n.name)); 
} 
marker.openInfoWindowHtml(WINDOW_HTML); 


} 
} 
+0

, 난 그렇게해야 내가 HTML 페이지에서 위치 이름을 표시 할 때 클릭 그 위치에있는 핀은 infoWindow와 함께지도에 표시됩니다. 나는지도에서 클릭 할 필요가 없습니다 –

+0

어떤 Google지도 버전이 v2 또는 v3을 사용하고 있습니까? – Pratik

+0

Google지도 v2를 사용하고 있습니다. –

답변

관련 문제