Maybe I'm going completely off track with what I'm trying to do, but I'm tempted just to go back to version 2 because I got that working easily (but I would like to be mobile-friendly).
I'm trying to generate a few markers, and to save code, I've put the marker generation into a for loop, which loops through an array of markers (there are actual values instead of (long,lat,x,x,x) in the real array).
Is something just going completely over my head?
function initialize() {
var latlng = new google.maps.LatLng(25, 15);
var myOptions = {
zoom: 2,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var myMarker = new Array();
myMarker[0] = new Array(long,lat,x,x,x);
myMarker[0] = new Array(long,lat,x,x,x);
myMarker[0] = new Array(long,lat,x,x,x);
myMarker[0] = new Array(long,lat,x,x,x);
myMarker[0] = new Array(long,lat,x,x,x);
myMarker[0] = new Array(long,lat,x,x,x);
myMarker[0] = new Array(long,lat,x,x,x);
for(var i = 0; i < myMarker.length; i++) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(myMarker[i](1), myMarker[i](2)),
map: map,
title: myMarker[i](5)
});
var infowindow = new google.maps.InfoWindow({content: myMarker[i](5)});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
}
This code works when I make the markers individually.