Javascript DOM HTML Paragraph handle mouse down and mouse up event

Description

Javascript DOM HTML Paragraph handle mouse down and mouse up event

View in separate window

<!DOCTYPE html>
<html>
<body>

<p onmousedown="myFunction(this,'red')" onmouseup="myFunction(this,'green')">
Click the text to change the color. 
</p>//w w w  .j  a  v a 2  s . com

<script>
function myFunction(elmnt,clr) {
  elmnt.style.color = clr;
}
</script>

</body>
</html>



PreviousNext

Related