new menu()
var m = new menu(text,function,text,function,...,...)
The texts appear on the buttons, and the functions are executed when
the button is clicked. Texts can be
-
plain text
- HTML text
- an image (a string ending with .gif, .png or .jpg). If "setIconDir()"
has been called, the images will be retrieved from that directory.
- a MapClient button object, created with "new button()". In that case,
the "function" parameter will not be used. It has to be
in the parameter list, so use "null" in its place. Use this method for
fancy buttons or complete HTML elements in a button (see User's Guide
2,4)
Functions can be:
-
Regular JavaScript functions.
-
Another menu. This menu has to exist already and will pop up next
to the button when this is clicked
Function can be the names of already defined functions, or anonymous
inline functions, like:
var m = new menu (
"text 1",function(){alert("pushed 1")},
"text 2",function(){alert("pushed 2")}
...
)
Note that with a named function the parentheses have to be omitted, else
the return value of the function will be passed, not the function itself.