You should be able to do that. From the code you show I don't think you should be getting the error you are reporting, though. The var map is not in the global scope. However, perhaps it is and you just haven't shown how that happens. If so, perhaps the:
method is not supported for the map object.
But it could be something else. Try just:
Code:
function callMe(lonlat,map){
alert(typeof map);
}
It should say object. Then the problem is the getLayers() method. But if it says undefined, it means either that the map variable isn't in the global scope, or that it hasn't been passed/called properly.
This is bad form:
Code:
<a href="javascript:callMe('40.1135,-111.8535',map);">click it</a>
It should be:
Code:
<a href="#" onclick="callMe('40.1135,-111.8535',map);return false;">click it</a>
I could probably tell exactly what the problem is if I had a link to the page.
Bookmarks