www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons JavaScript onMouseDown, onMouseUp, onMouseMove Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19
Lesson 20
Lesson 21
Lesson 22
Lesson 23
Lesson 24
Lesson 25
Lesson 26
Lesson 27
Lesson 28
Lesson 29
Lesson 30
Lesson 31
Lesson 32
Lesson 33
Lesson 34
Lesson 35
Lesson 36
Lesson 37
Lesson 38
Lesson 39
Lesson 40
Lesson 41
Lesson 42
Lesson 43
Lesson 44
Lesson 45
Lesson 46
Lesson 47
Lesson 48
Lesson 49

onMouseDown, onMouseUp and onMouseMove events can be associated with images, hyper links, div sections, tables etc.

onMouseDown event is triggered when the mouse button is pressed over the resource to which the onMouseDown event is associated.

onMouseUp event is triggered when the mouse button is released over the resource to which the onMouseUp event is associated.

onMouseMove event is triggered when the mouse pointer moves over the resource to which the onMouseMove event is associated.

The followin example illustrates the usage of the onMouseDown, onMouseUp and onMouseMove events:

<html>
<head>
<script type="text/JavaScript">

function mouseDown() {
alert("The mouse button pressed on the image");
}

function mouseUp() {
alert("The mouse button is released on the image");
}

function mouseMove(){
alert("The Mouse moves over the Image");
}

</script>

</head>

<body>
<img src="http://pickatutorial.com/resources/logo.jpg" onMouseDown="mouseDown()">
<br>
<img src="http://pickatutorial.com/resources/logo.jpg" onMouseUp="mouseUp()">
<br>
<img src="http://pickatutorial.com/resources/logo.jpg" onMouseMove="mouseMove()">
</body>

</html>

Note that there are two different events for the mouse button click i.e. one is triggered when the button is pressed, but not release, and the other when the button is released.


Next >>> Lesson No. 28: JavaScript Keyboard Events







Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.