JavaScript Events

best javascript training in hyderabad

JavaScript Events

JavaScript Events : Event is a flow of action, Occurrence happening at a determinable time and place, with or without the participation of human or thing.

 

Syntax of a Event :-

<button value=”click me!” onclick=”alert (‘Thank you!’)”></button>

best javascript training in hyderabad

JavaScript can be executed when an event occurs, like when a user clicks, key press, browse, move,…etc on an HTML element

There  are some examples of HTML events Like

  1. when user clicking the mouse over a certain element or hovering the cursor pointer over a particular  element.
  2. while user pressing a key on the keyboard.
  3. when  user resizing or closing the browser windows.
  4. when page loaded or unloaded
  5. while form submitted or reset.
  6. when error occurring .
  7. when audio, video, play, paused, finishing on browser window.

Types Of Event :

We can create events in two ways

  1. Event Handler
  2. Event Listener

Event Handler :

Using event handler, When action performed in DOM will calls a function in script.If function calling is written in DOM(HTML) that is called Event Handler.

Event Listener :

Using event handler, When action performed in DOM will calls a function in script.If function calling is written in script that is called Event Listener. While using Event Listener , you no need touch html – It means you can manage everything form javascript only without help of html.

 

JavaScript Events List

onload:- The browser has finished loading the page

unload:- The document or a dependent resource is being unloaded.

online:-The browser has gained access to the network.

offline:- The browser has lost access to the network.

focus:- An element has received focus (does not bubble).

blur:- An element has lost focus (does not bubble).

scroll:- The document view or an element has been scrolled.

keydown:- ANY key is pressed

keypress:- ANY key except Shift, Fn, CapsLock is in pressed position. (Fired continously.)

keyup:- ANY key is released

mouse enter:- A pointing device is moved onto the element that has the listener attached.

mouserleave:-A pointing device is moved off the element that has the listener attached.

mouserover:- A pointing device is moved onto the element that has the listener attached or onto one of its children.

mousemove:- A pointing device is moved over an element. (Fired continously as the mouse moves.)

mousedown:- A pointing device button is pressed on an element.

mouseup:- A pointing device button is released over an element.

mouseout:- A pointing device is moved off the element that has the listener attached or off one of its children.

onwheel:- A wheel button of a pointing device is rotated in any direction.

onclick:- A pointing device button (ANY button; soon to be primary button only) has been pressed and released on an element.

dblclick:- A pointing device button is clicked twice on an element.

select:- Some text is being selected.

dragestart:- The user starts dragging an element or text selection.

drage:- An element or text selection is being dragged (Fired continuously every 350ms).

dragenter:- A dragged element or text selection enters a valid drop target.

dragend:- A drag operation is being ended (by releasing a mouse button or hitting the escape key).

drageover:- An element or text selection is being dragged over a valid drop target. (Fired continuously every 350ms.)

drageleave:- A dragged element or text selection leaves a valid drop target.

drop:-An element is dropped on a valid drop target.

 

 

finally, your completed events topic, If you wants learn complete javascript click on below link:

JavaScript Introducion

 

Want to learn complete JavaScript (Online/Classroom) then fill below details



Please follow and like us:
500

1 thought on “JavaScript Events

Leave a Reply

Your email address will not be published. Required fields are marked *