Javascript DOM HTML Paragraph handle mouse down and mouse up event
<!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>