RegisterEventHandler()

Syntax:

RegisterEventHandler( EventName, EventFunction )

Return:

An identifier for the added event handler, which may be used to remove the Event Handler at a later time using the UnRegisterEventHandler function – usually stored in a variable for ease.

Parameters:

EventName – the name of the event (or trigger) that the function is to handle. EventName must be surrounded by quote marks and must be one of the events described below – see Remarks for more information. This parameter is required.

EventFunction – a function that will handle the event. The function should take one argument that will be an object containing information about the event that triggered the call. This parameter is required.

Remarks:

There are a variety of EventNames that can be passed to the EventFunction, these fall into two categories:

  1. (i) Mouse Events – events that happen when the user presses a button on a mouse.

  2. (ii) Keyboard Events – events that happen when the user types a key on the keyboard.

Mouse Events:

Event Name

Description

mouseover

mouse moves over the object.

mouseout

mouse moves off the object.

lmousedown

left mouse button is pressed down.

lmouseup

left mouse button is released.

lclick

left mouse button is clicked once over the object.

ldblclick

left mouse is double-clicked over the object.

rmousedown

right mouse button is pressed down.

rmouseup

right mouse button is released.

rclick

right mouse button is clicked once over the object.

rdblclick

right mouse button is double-clicked over the object.

mousemove

the mouse is moved.

mousewheelup

the mouse moved up.

mousewheeldown

the mouse moved down.

 

 

The properties of the event object of Mouse Events are:

x

x coordinate of the mouse, relative to the top left corner of the page.

y

y coordinate of the mouse, relative to the top left corner of the page.


Keyboard Events:

Event Name

Description

keydown

a key was pressed down.

keyup

a key was released.

keypress

a key was pressed generating a character

 

 

The properties of the event object of Keyboard Events are:

key

the character of the key that was pressed.

autorepeat

the number of times the event has autorepeated i.e. 0 (zero) for the first time.

 

image\Script_Button.jpgExamples