JavaScript Rollover Tutorial

Standard Javascript rollovers

On many web pages, JavaScript rollovers are handled by adding an onmouseover and onmouseout event on images.

  • onmouseover is triggered when the mouse moves over an element
  • onmouseout is triggered when the mouse moves away from the element

Syntax

In HTML:

<element onmouseover="myScript">

In JavaScript:

object.onmouseover = function(){myScript};

In JavaScript, using the addEventListener() method:

object.addEventListener("mouseover", myScript);

Example: 1

Execute a JavaScript when moving the mouse pointer onto an image it gets bigger:

Example: 2

Execute a JavaScript when moving the mouse pointer onto an image it changes:

Take Your Free Live Demo Class Now

We Will Call Back You Shortly

Enter Your DETAILS BELOW

We Will Send You the Course Fees Details In Below Number

Enter Your DETAILS BELOW

We Will Call Back You Shortly

Enter Your DETAILS BELOW

We Will Call Back You Shortly

Enter Your DETAILS BELOW

Enter Your DETAILS BELOW TO take

free demo class