- Roseo
- Jun 1, 2000
-
Forum Veteran
|
Anyone have idea why this won't generate markers in an embedded Google Map under Chrome but works on every other browser I've tested it under? I know it can stand to be refactored, but I can't figure out why the gently caress this basic code doesn't generate my markers.
code:var info = [ 'html', 'html', 'html' ];
var locs = [ '40', '-50', '42', '-51', '44', -56' ];
function drawmap() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
var id = 1;
while (locs.length > 0) { // While the array is populated...
var point = new GLatLng(locs.shift(), locs.shift()); //locs is array of alternating lats and longs, shift it twice to get the coords back.
map.addOverlay(createMarker(point, id));
id++;
}
}
}
function createMarker(point, id) {
var towerIcon = new GIcon(baseIcon);
var marker = new GMarker(point);
marker.value = id;
GEvent.addListener(marker, "click", function() {
var html = info[id-1];
map.openInfoWindowHtml(point, html);
});
return marker;
}
Roseo fucked around with this message at 01:57 on Apr 8, 2009
|
#
¿
Apr 8, 2009 01:50
|
|
- Adbot
-
ADBOT LOVES YOU
|
|
#
¿
May 8, 2024 15:32
|
|