I would like to display the content of an array in a Googlemap bubble. I wonder why the following code is not working properly, since I only see the title but not the news in the bubble.
function addMarker(latitude, longitude, title, news)
{
var marker = new GMarker(new GLatLng(latitude, longitude));
GEvent.addListener(marker, click ,function() {
marker.openInfoWindowHtml(title, news);
});
map.addOverlay(marker);
}
function init()
{
if (GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom);
for (id = 0; id < markers.length; ++id)
{
addMarker(markers[id].latitude, markers[id].longitude, markers[id].title, markers [id].news); //
}
}
}
window.onload = init;
window.onunload = GUnload;
这就是阵列结构:
var markers = [
{
latitude : 56.7382105,
longitude : 12.8584020,
title : Hallo Planet ,
news : blaaaa blaaaa blaaaa.
},
{
latitude : 62.6549167,
longitude : 16.6354329,
title : Hallo World ,
news : bla bla bla.
},
];
我在“曲线”<代码>>>>><>>>/代码”之后也尝试了,但结果完全相同。