[Javascript] Anonymous functions

Terry Riegel riegel at clearimageonline.com
Tue Dec 4 15:46:10 CST 2007


Nick,

Thanks, that did work without error, but how would I then call the  
function?


Terry



On Dec 4, 2007, at 2:43 PM, Nick Fitzsimons wrote:

> On 4 Dec 2007, at 18:51, Terry Riegel wrote:
>
>> 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?
>
> You should be able to use
>
> var listener = GEvent.addListener(map, "moveend", function
> myNamedFunction() {
>
> without any problem. Does that not work?
>
> Regards,
>
> Nick.
> -- 
> Nick Fitzsimons
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
>




More information about the Javascript mailing list