[Javascript] Anonymous functions
Terry Riegel
riegel at clearimageonline.com
Tue Dec 4 12:51:48 CST 2007
Hello everyone,
I have this code snip...
var listener = GEvent.addListener(map, "moveend", function() {
document.getElementById("mapinfo").innerHTML="Zoom: "+map.getZoom()
+" Bounds: "+map.getBounds();
GDownloadUrl(url, function(data, status) {
markers=eval(data);
map.clearOverlays();
for (var i in markers) {
var where = new GLatLng(markers[i].lat, markers[i].lng);
var opts = {title: markers[i].title};
var marker = new GMarker(where, opts);
map.addOverlay(marker);
}
});
});
I would like to take the first function() {...} and make it a named
function, but when I do it I get something like map undefined. How do
I un-anonymous-ize a function?
Thanks for any help.
Terry Riegel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20071204/e7c54508/attachment.htm>
More information about the Javascript
mailing list