Google Maps openInfoWindowHTML array problem
Posted
by user188791
on Stack Overflow
See other posts from Stack Overflow
or by user188791
Published on 2010-04-07T03:26:11Z
Indexed on
2010/04/07
3:33 UTC
Read the original article
Hit count: 338
google-maps
|multidimensional-array
Could someone please help explain why I can't get this to work? I properly generates all the locations, however, it doesn't generate the info boxes. Why is this and can someone help me with it?
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(47.6062, -122.3321), 8);
var wa_locations = new Array(new Array("Seattle", "47.6062", "-122.3321", "###-###-####", "###-###-####"),
new Array("Bellevue", "47.6104", "-122.2007", "###-###-####", "###-###-####"),
new Array("Tacoma", "47.2529", "-122.4443", "###-###-####", "###-###-####"),
new Array("Everett", "47.9790", "-122.2021", "###-###-####", "###-###-####"));
for(var i = 0; i < wa_locations.length; i++)
{
var point = new GLatLng(wa_locations[i][1], wa_locations[i][2]);
map.addOverlay(new GMarker(point));
GEvent.addListener(point, "click", function()
{
point.openInfoWindowHtml("<b>" + wa_locations[i][0] + "</b><br/>Sales: " + wa_locations[i][3] + "<br/>Helpdesk: " + wa_locations[i][4] + "");
});
}
© Stack Overflow or respective owner