vince schreef:
> thanks for the link ...
> But i wonder how i can rewrite the code with this ForEach function.. it's
> not the same syntax ? sorry but i'm not very good with javascript.
>
> here is the code :
>
>     
>         link = ' # '+element.name+' <br />';
>         $('p#location_list').append(link);                            
>     });
>
>   
if think if you use

function ForEach(array, fn)
{
  for (var n = 0; n < array.length; n++)
    fn(array[n]);
}

you have to rewrite it like this

ForEach(locations,function(element, index, array) {
        var marker = new GMarker(new GLatLng(element.latitude,
element.longitude), {title: element.name});
        map.addOverlay(marker);
        GEvent.addListener(marker, 'click', function() {
            marker.openInfoWindowHtml('Name: '+element.name+'<br />Latitude:
'+element.latitude+'<br />Longitude: '+element.longitude+'');       
        });



-- 
David Duymelinck
________________
[EMAIL PROTECTED]


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to