Altova StyleVision 2023 Enterprise Edition

Assigning Functions as Event Handlers

Home Prev Top Next

In the StyleVision GUI, you can assign JavaScript functions as event handlers for events that occur on the HTML renditions of SPS components. These event handlers will be used in the HTML output. The event handler for an available event—such as onclick—is set by assigning a global function as the event handler. In the Properties sidebar, global functions defined in the JavaScript Editor are available as event handlers in the dropdown boxes of each event in the Events property group for the selected component (screenshot below).

 

EH_Properties_Event

 

To assign a function to an event handler, do the following:

 

1.Select the component in the SPS for which the event handler is to be defined. The component can be a node or content of any kind, dynamic or static.

2.In the Properties sidebar select the Event group. This results in the available events being displayed in the Attribute column (screenshot above).

3.In the Value column of the required event, click the down arrow of the combo box. This drops down a list of all the functions defined in the JavaScript Editor.

4.From the dropdown list, select the required function as the event handler for that event.

 

In the HTML output, when that event is triggered on the component for which the event handler is defined, the JavaScript function is executed.

 

© 2017-2023 Altova GmbH