Buttons: HTML
There are two very powerful extensions to this simple menu system, one
for the button's text item, the other for its function.
To use them, we have to create buttons individually, and add them each
to a menu with the "addButton" method. A simple menu
is created with:
m = new menu("text1",func1,"text2",func2)
In
this is rewritten as:
b1 = new button("text1",func1)
b2 = new button("text2",func2)
m = new menu()
m.addButton(b1)
m.addButton(b2)
This looks like more work, but now you have much more control over what
you put in the texts and functions. An example is in
.
First of all, instead of a literal
text, you can put HTML code in the first parameter:
b1 = new button("<span style='font-size:20pt;backgound-color:green'>text1</h1>",func1)
b2 = new button("<a style='font-size:30pt;background-color:white' href=http://mapserver.gis.umn.edu>mapserver</a>",null)
Both buttons are now displayed in their own styles. The first one calls
a user defined function, the second one does not call a JavaScript function,
but as it is a hyperlink, it immediately transfers to a new web-page.