I've been at this for about a week now, and still can't get my Google Map to properly number the markers. Any help would be greatly appreciated. I've done enough "googling" on the subject matter, and finally needed to make a forum thread.
My JavaScript code:
<script type="text/javascript">
function load() {
var url = document.location.href;
if (url.match("view")) {
var map_url = 'single_site.php';
} else {
var map_url = 'phpsqlajax_genxml2.php';
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(41.9034,-87.627944),13);
GDownloadUrl(map_url, function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var type = markers[i].getAttribute("type");
var area = markers[i].getAttribute("area");
var pic = markers[i].getAttribute("pic");
var num = markers[i].getAttribute("num");
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = createMarker(point, name, address, type, pic, area, num);
map.addOverlay(marker);
}
});
}
}
}
//THIS IS WHERE THE MARKER NUMBERING BEGINS
var num = '1';
var iconRed = new GIcon();
iconRed.image = "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=" + num +"|666666|000000";
//'http://www.millenniumparkplaza.com/bjb/site/images/dot.jpg';
//iconRed.iconSize = new GSize(12, 20);
iconRed.shadowSize = new GSize(22, 20);
iconRed.iconAnchor = new GPoint(6, 20);
iconRed.infoWindowAnchor = new GPoint(5, 1);
var customIcons = [];
customIcons["apt"] = iconRed;
function createMarker(point, name, address, type, pic, area, num) {
var marker = new GMarker(point, customIcons[type]);
//var html = "<h2>Address: " + address + "</h2> <br/>" + area;
var html = "<h2>Address</h2> <b>" + address + "</b> <br/>" + area + "<img src=\"" + pic + "\" width=\"100px\" height=\"100px\" style=\"float:right;\">";
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
</script>
Any help would be greatly appreciated. It's set to "1" so that it doesn't error out, but I simply can't get the markers to display 1,2,3,4,5...etc based on my search results.
The live version is here: http://www.millenniumparkplaza.com/bjb/site/index.php?p=properties
Thank you for any help that can be provided. I am a JavaScript beginner, but well familiar with PHP.