Hi guys,
Forgive me if this is a stupid question as I'm fairly new to computing. Been trying to make a webpage that displays a googlemap with multiple markers based on data from an XML file but can't seem to get it to work. Would be ETERNALLY grateful to anyone who can pick out where I'm going wrong!
<html>
<head>
<script type="text/javascript">
function callXML(){
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","partners.xml",false);
xmlhttp.send();
return xmlhttp.responseXML;
}
xmlDoc=callXML();
var partners=xmlDoc.getElementsByTagName("partner");
var lats=new Array();
var lngs=new Array();
var titles=new Array();
var descs=new Array();
var lat;
var lng;
var title;
var desc;
for (var i=0;i<partners.length;i++) {
lat=partners[i].getAttribute("lat");
lats.push(lat);
lng=partners[i].getAttribute("lng");
lngs.push(lng);
titles=partners[i].getAttribute("title");
titles.push(title);
descs=partners[i].getAttribute("desc");
descs.push(desc);
}
var latlng = new google.maps.LatLng(lats[0], lngs[0]);
var myOptions = {zoom: 11, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP};
var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
for (i=0;i<partners.length;i++){
latlng = new google.maps.LatLng(lats[i], lngs[i]);
marker= new google.maps.Marker({position: latlng, map: map, title: titles[i]});
}
</script>
</head>
<body>
<div id="map_canvas">
</div>
</body>
</html>