Menu ▼

Previous Next

Mousemove event in JavaScript :

Mousemove event will be fired when the cursor moves on a control.

Example:
-------------

Place the mouse here...
-------------------------------------------------------
Welcome to Dotnet Learners.... Dotnet Learners is an free online tutorial, In this section you will learn javascript step by step with example and detail explanation. Here we covered different parts of javascript like basics of javascript alert message, confrimation message, variable types, for loop, key events like key down, key press and key up and mouse events like mouseover event in javascript, mousemove event in javascript, mouseout event in javascript, mousedown event in javascript, click event in javascirpt, mouseup event in javascript and double click event in javascript and exception handling controls validations, stirng operations, table operations manual ajax and lot more....


Code Sample :

<html>

<head>

    <title>Mousemove event example in JavaScript</title>

    <script language="Javascript">

        var cnt = 0;

        var arybg = new Array("Red", "Green", "Blue", "Yellow", "Black", "Brown");

        var aryfore = new Array("white", "white", "white", "Red", "white", "Black");

 

        function mousemoveevt(evt, t) {

            if (cnt == arybg.length)

                cnt = 0;

            t.style.backgroundColor = arybg[cnt];

            t.style.color = aryfore[cnt];

            cnt++;

        }

 

    </script>

</head>

<body>

    <table align="center">

        <tr>

            <td>

                <div onmousemove="mousemoveevt(event,this);" style="width: 400px; text-align: justify;

                    border: solid 1px black; padding: 10px;">

                    Place the mouse here...<br />

                    -------------------------------------------------------<br />

                    Welcome to Dotnet Learners.... Dotnet Learners is an free online tutorial, In this

                    section you will learn javascript step by step with example and detail explanation.

                    Here we covered different parts of javascript like basics of javascript alert message,

                    confrimation message, variable types, for loop, key events like key down, key press

                    and key up and mouse events like mouseover event in javascript, mousemove event

                    in javascript, mouseout event in javascript, mousedown event in javascript, click

                    event in javascirpt, mouseup event in javascript and double click event in javascript

                    and exception handling controls validations, stirng operations, table operations

                    manual ajax and lot more....

                </div>

            </td>

        </tr>

    </table>

</body>

</html>

Previous Next




Search dotnetlearners.com