Javascript Events

Javascript Events

Attaching JavaScript events to elements on your website is a great way to enhance the interactivity and user experience of your site. You can attach JavaScript events to any element in your website. JS events are any instance of interaction with the page, via mouse, keyboard, or forms. This feature requires minimal JavaScript knowledge.

Accessing the JavaScript events

  1. Click on the element you would like to customize.

  1. Click the JavaScript Events [] icon on the element property box.

  1. Specify the function to be applied when an event occurs.

 

  1. Go to Pages.

  1. Select the page in which you want the JavaScript event.

  1. Click Edit Page Info.

 

 

  1. Define the function in the corresponding page header/footer code.

  1. Click Save.

 

Sample Code:

 

  1. Next, you can save and publish your site. When you click the button in your published site, the function will be applied. In this case, the alert box will appear as per the code.

You can input various function names to apply different event types for any element.

 

Types of JavaScript events

We currently support six events:

  • onclick  

The click event fires when the user clicks on an element that has the listener attached.

  • ondblclick  

The dblclick event fires when the user double clicks an element that has the listener attached.

  • onmouseover  

The mouseover event fires when the user moves the mouse over an element that has the listener attached.

  • onmouseout  

The mouseout event fires when the mouse leaves an element that has the listener attached.

  • onmouseenter

The mouseenter event fires when a pointing device (usually a mouse) is moved over the element that has the listener attached.

  • onmouseleave  

The mouseleave event fires when a pointing device (usually a mouse) is moved off the element that has the listener attached.