Javascript DOM onmouseup Event

Introduction

Execute a JavaScript when releasing a mouse button over a paragraph:

View in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP" onmousedown="mouseDown()" onmouseup="mouseUp()">
Click the text! /*from  w  w  w.  j  a va 2 s. co  m*/
</p>

<script>
function mouseDown() {
  document.getElementById("myP").style.color = "red";
}

function mouseUp() {
  document.getElementById("myP").style.color = "green";
}
</script>

</body>
</html>

The onmouseup event occurs when a user releases a mouse button over an element.

Bubbles:
Cancelable:
Event type:
Supported HTML tags:











Yes
Yes
MouseEvent
All HTML elements, EXCEPT:
<base>,
<bdo>,
<br>,
<head>,
<html>,
<iframe>,
<meta>,
<param>,
<script>,
<style>, and
<title>



PreviousNext

Related