in html onclick change colour code example
Example 1: onclick change text color javascript
<script>
document.getElementById('change').onclick = changeColor;
function changeColor() {
document.body.style.color = "purple";
return false;
}
</script>
Example 2: css onclick change color
<style>
.dabutton:focus {
background-color:yellow;
}
</style>
<button class="dabutton"></button> // <-- usage