0
我使用谷歌地圖顯示標記與信息窗口..我顯示地址,但我想顯示名稱以及在信息窗口中點擊標記時。任何幫助將不勝感激。谷歌地圖信息窗口
function load() var map = new GMap2(document.getElementById(「map」));
map.setCenter(new GLatLng(-37.816667,144.966667),10); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl());
var geocoder = new GClientGeocoder();
GDownloadUrl("shops.xml", function(data) {
var xml = GXml.parse(data);
shop = xml.documentElement.getElementsByTagName("shop");
for (var i = 0; i < shop.length; i++) {
var name= shop[i].getElementsByTagName("name");
name = name[0].childNodes[0].nodeValue;
var address= shop[i].getElementsByTagName("address");
address = address[0].childNodes[0].nodeValue;
geocoder.getLocations(address, addToMap);}
}); }
功能addToMap(響應) { 地點= response.Placemark [0]; point = new GLatLng(place.Point.coordinates [1],place.Point.coordinates [0]);
function createMarker(point,address)
{
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function()
{
map.openInfoWindowHtml(point, address);
});
return marker;
}
map.addOverlay(createMarker(point, response.name));
}
你能告訴我一些代碼 – mike 2011-05-21 01:21:28