<!DOCTYPE html>
<html>
<body>
<p id="pid" onmousedown="mouseDown()" onmouseup="mouseUp()">
Click this text. The mouseDown() sets the text color to red.
The mouseUp() sets the text color to blue
</p>
<script>
function mouseDown() {
document.getElementById("pid").style.color = "red";
}
function mouseUp() {
document.getElementById("pid").style.color = "blue";
}
</script></body>
</html>