Like most modern programming languages, LZX is event-driven. User Interface components have events (For example: oninit, onclick, onmousedown, onmouseup, ...). You can write standard JavaScript code to define the component's behavior when a specific event is triggered. LZX is really the combination of two standards: XML (to declaratively define the User Interface) and embedded JavaScript (to define components' behaviors).

Notice that we used a different syntax to define the event handler for the Pause button and for the Resume button.
  • For the Pause button, we used the onclick attribute of the <button> tag.
  • For the Resume button, we defined a <method> inside the <button> to handle the event. This approach is usually more readable when the event handler involves multiple lines of code.