JavaScript

Unlike PHP, JavaScript is executed by the browser, not by the webserver. JavaScript can also capture mouse and keyboard events.

With JavaScript you can access all elements of the current web page after they have been positioned on the screen and modify their position or style. You can also send commands to the browser.

To add JavaScript to an item, select the object and choose Action > On Click, On Over, On Out, On Focus, On Blur, On Change commands.

On Click is executed when the user click the item

On Over is executed when the user moves the mouse cursor over the item

On Out is executed when the user moves the mouse cursor out the item

On Focus is executed when the item activates for keyboard events, for example an input field is ready to receive keystrokes

On Blur is executed when the item looses focus and is deactivated for keyboard entry

On Change is executed when the content of the input field or text area has been changed or list selection has been changed

The simplest JavaScript

Choose Insert > Button and then Action > On Click. Type the code:

Click the button below to test it

DOM (Document Object Model)

You can access all elements of your web page by getElementById function.

Before you can access the item you have to name it. Select the item and press F2

Text Item 1

     

In the above example you can click the button to change the color of text. Each button has On Click action defined:

The complete JavaScript and DOM reference can be found at W3 website: