<!DOCTYPE html>
<html>
<head>
<style>
#div-id {
cursor: pointer;
background-color: cornflowerblue;
width: 200px;
height: 30px;
padding: 10px;
}
</style>
</head>
<body>
<div id="div-id" onmousedown="MouseDown(this)"
onmouseup="MouseUp(this)">
onmousedown and onmouseup
</div>
<script>
function MouseDown(obj)
{
obj.style.backgroundColor = "lavender";
}
function MouseUp(obj)
{
obj.style.backgroundColor = "cornflowerblue";
}
/*
run:
onmousedown and onmouseup colors are changed
*/
</script>
</body>
</html>