Javascript DOM onmouseup Event via HTML Tag onmouseup attribute

Introduction

This example demonstrates how to assign an "onmousedown" and "onmouseup" event to a p element.

View in separate window

<!DOCTYPE html>
<html>
<body>
<p id="demo" onmousedown="mouseDown()" onmouseup="mouseUp()">Click me.</p>

<script>
function mouseDown() {/*  w  ww .j av a  2 s . c  o m*/
  document.getElementById("demo").innerHTML = "The mouse button is held down.";
}

function mouseUp() {
  document.getElementById("demo").innerHTML = "You released the mouse button.";
}
</script>

</body>
</html>
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