Mousedown event in JavaScript

Mousedown event will be fired when mouse click on a control. Before the "onclick" and "onmouseup" events.

Example:

Click 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>Mousedown 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 mousedownevt(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 onmousedown="mousedownevt(event,this);" style="width: 400px; text-align: justify; border: solid 1px black; padding: 10px;"> Click 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>