<!DOCTYPE html>
<html>
<head>
<script>
function clickFunct()
{
var a;
a = document.getElementById("counterId").innerHTML;
document.getElementById("counterId").innerHTML = parseInt(a, 10 ) + 1;
}
function mouseOverFunct()
{
document.getElementById("divId").style.color="white";
}
function mouseOutFunct()
{
document.getElementById("divId").style.color="inherit";
}
</script>
</head>
<body>
<div id="divId" style="cursor:pointer;">Click here</div>
<script>
if (document.addEventListener)
{
document.getElementById("divId").addEventListener("click", clickFunct);
document.getElementById("divId").addEventListener("mouseover", mouseOverFunct);
document.getElementById("divId").addEventListener("mouseout", mouseOutFunct);
}
else// evtl for cross browser support
if(document.attachEvent)
{
document.getElementById("divId").attachEvent("onclick", clickFunct);
document.getElementById("divId").attachEvent("onmouseover", mouseOverFunct);
document.getElementById("divId").attachEvent("onmouseout", mouseOutFunct);
}
</script>
</body>
</html>