I finally got it to work by using a addclickevent function – thanks
for the help and hint.
I include the code for any others with the same problem.
Thanks guys :-)
(function(){if(window.XMLHttpRequest)return;var o=null,s,
a=["MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.
3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];
for(var i=0,j=a.length;i<j;s=a[i],i++){try{if(o=new ActiveXObject(s))
break}
catch(e){}}window.XMLHttpRequest=o?function(){return new ActiveXObject
(s)}:null;o=null})()
function load_php(type,id) {
var nocache = Math.random();
var oHttp = new XMLHttpRequest();
oHttp.open("get", "googlemaps_getdata.php?type="+type+"&id="+id
+"&nocache="+nocache, false);
oHttp.onreadystatechange = function(){};
oHttp.send(null);
return oHttp.responseText;
}
var themarker = new Array();
var aid;
var lat;
var lng;
function addClickevent(marker) {
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(load_php("arbplads",aid));
});
return marker;
} // endfunction adclick
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(55.684343, 12.590976), 12);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.enableScrollWheelZoom();
map.enableContinuousZoom();
var data = load_php("list","");
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
lat = parseFloat(markers[i].getAttribute("lat"));
lng = parseFloat(markers[i].getAttribute("lng"));
aid = parseFloat(markers[i].getAttribute("id"));
themarker[i] = new GMarker(new GLatLng(lat, lng));
map.addOverlay(themarker[i]);
addClickevent(themarker[i]);
}
} // endif GBrowserIsCompatible()
} // end function initialize()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---