views:

18

answers:

2

Dear all,

After hours of debugging, I have to ask some help...

I try to make this work on IE : http://ferc.noisy.ch/professionnels-plan.html (user and pwd : ferc)

It works fine with FF, but with IE6/7/8 I have the following message :

Line:133
Character: 18
Error : invalid argument

After some investigation, I found that the problem seems to come from map.addOverlay(marker); at the end of the GDownloadUrl() function.

The marker is built that way :

var gmarkers = []
var gicons = [];
...
function createMarker(point, html,category) {
 var marker = new GMarker(point,gicons[category]);
 marker.mycategory = category;                                 
 GEvent.addListener(marker, "click", function() {
  marker.openInfoWindowHtml(html);
 });
 gmarkers.push(marker);
 return marker;
}
var marker = createMarker(point,html,category);

html is a piece of information coming from the xml file

category is a number to classify the markers

point is... a point :-)

I also try to remove the openInfoWindowHtml, but the problem is always the same... :-(

So, thank you in advance for any advice !

BR, Malik

A: 

It's been a while since I messed about with the Google Maps api, but I seem to remember having a similar problem myself.

Try calling addOverlay before attaching the listener:

function createMarker(point, html,category) {
 var marker = new GMarker(point,gicons[category]);
 marker.mycategory = category;
 map.addOverlay(marker);                    
 GEvent.addListener(marker, "click", function() {
  marker.openInfoWindowHtml(html);
 });
 gmarkers.push(marker);
 return marker;
}
nukefusion
Thank you for your proposal, but no... the problem is still the same... I also tried to put the whole thing in a loadGM() function called with jQuery on document ready, but no...
A: 

Ok, I found the answer ! I'm a real newbie making such error : the script was not in head but in the body...

now it works !

By the way, thank you nukefusion :-)