XML technologies / MathML / Presentation markup / Other elements / Setting up actions

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

The maction element provides a mechanism for adding interactivity to MathML equations. This element associates a type of action with an MathML expression. You can then program a processing application to perform the specified action in response to a user event (such as clicking or moving the mouse over the MathML expression).

An maction element can contain any other MathML elements and can have any number of arguments. This element has the following two attributes:

Some examples of possible values of actiontype along with the actions associated with them are given below. Note that all these example are hypothetical. They are provided only to illustrate the concept. For these values of the actiontype attribute to work as indicated, they must first be implemented by a specific application. A MathML application that does not recognize a value specified for actiontype will just render the selected subexpression without performing the action.

With actiontype="toggle", a rendering application would display one of a given series of subexpressions. Each time the user clicks the displayed subexpression, the renderer would update the value of selection by 1 and cause the next expression in the series to be displayed. Here is an example illustrating this behavior:

<maction actiontype="toggle" selection="1">    (expression1)    (expression2) </maction>

With actiontype="statusline", clicking or moving the mouse over an expression would cause the specified message to appear in the status line of the browser, as shown here:

<maction actiontype="statusline">   (expression)   (message) </maction>

With actiontype="tooltip", clicking or moving the mouse over an expression would cause the message to be displayed in a pop-up tooltip box near the expression, as follows:

<maction actiontype="tooltip">   (expression)   (message) </maction>

With actiontype="highlight", clicking or moving the mouse over an expression would cause the message to be displayed in a different color and/or with a different background, as shown here:

<maction actiontype="highlight" xhtml:color="red" xhtml:background="yellow">   expression </maction>

In the above example, the color and background are specified by two other attributes from a different namespace.

With actiontype="menu", clicking or moving the mouse over an expression would cause a pop-up menu to be displayed. A typical MathML expression using this attribute would have the following structure:

<maction actiontype="menu" selection="1">   (menu item 1)   (menu item 2) </maction>

The items in the menu above are determined by the arguments of the <maction> element. Since a <maction> element can contain any other MathML elements, each menu item could itself be a MathML expression, to allow a user to choose from different forms of an expression.

   

 

 

 

 

back to top