Summary: | makeButton: more javascript parameters | ||
---|---|---|---|
Product: | Chameleon | Reporter: | Bart van den Eijnden <bartvde@osgis.nl> |
Component: | Core | Assignee: | chameleon-dev <chameleon-dev@lists.maptools.org> |
Status: | RESOLVED INVALID | ||
Severity: | enhancement | ||
Priority: | P2 | ||
Version: | 1.99 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
you can pass an array as a paramater and it should be converted into a javascript array when passed to your javascript function. You just need to know what is in the array :)
Paul, so this means it is an assumption of the button API to only support javascript functions on the onClick event which take 1 parameter? A simple parameter, or an array or object? But not functions which take 2 or more simple parameters?
that's correct. To support multiple simple parameters, you need to put them into an array. But I think it should be possible to support multiple parameters. I've become a fan of the 'arguments' array in javascript functions recently: function varArgs( /*variable number of arguments*/ ) { var i; var szArgs = ""; var szSep = ""; for (i=0; i<arguments.length; i++) { szArgs = szArgs + szSep + arguments[i]; szSep = ","; } alert( "arguments were " + szArgs ); }