Hi all
I'm adding buttons to my map through a loop. I pass some parameters,
and the addButtons() function creates the buttons. How can I pass the
"task" for the button to the function? In the addListener line, I'm
now writing the function name literally, I'd like find a way with a
parameter.
Thank you..

// The loop...
for (i=0;i<=4;i++)      {
        oCC = addButtons(aCtrls[i],'btnContainerChild');
        ...
        }

// The function...
function addButtons(cButtonID,cClassName) {
        var oButton = document.createElement('DIV');
        oButton.className=cClassName;
        oButton.id=cButtonID;
        //... other settings here...

// ===> Here, I'd like to set the click function through a parameter
        google.maps.event.addDomListener(oButton, 'click', function()
{gmapSetCenter(defaultCenter)});
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to