Re: How to add text-bubbles to " Using XML and Asynchronous RPC ("AJAX")" ???
i've tred it with a static text for the buble like this:
    var map = new GMap(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
    map.centerAndZoom(new GPoint(11.0333, 51.4000), 11);
	var request = GXmlHttp.create();
	request.open("GET", "data.xml", true);
	request.onreadystatechange = function() {
	  if (request.readyState == 4) {
	    var xmlDoc = request.responseXML;
	    var markers =
xmlDoc.documentElement.getElementsByTagName("marker");
		for (var i = 0; i < markers.length; i++) {
	      var point = new
GPoint(parseFloat(markers[i].getAttribute("lng")),
parseFloat(markers[i].getAttribute("lat")));
	      var marker = new GMarker(point);
		 map.addOverlay(marker);
		  var html = "test..."
		 GEvent.addListener(marker, "click", function() {
  		 marker.openInfoWindowHtml(html);
		 });
 	   }
	  }
	}
request.send(null);
but doesn't matter with marker i click the bubble allways opens on the
one which is last in the data.xml
What's wrong here?
And how can I replace the static-text with one which's read from the
xml file?
I tried modifying the code from above like this:
var html = parseFloat(markers[i].getAttribute("txt"))
and added the text to the xml file like this:
<marker lat="51.3667" lng="12.3833" txt="You're in sample"/>
but now i don't get markers at all on my map ...
Can someone help me???
0 Comments:
Yorum Gönder
<< Home