Writing a style block will probably not affect the background color change. To do this, you need to manipulate the Document object:
<script type="text/javascript">
function Clicker(number){
if (number == 1)
document.body.style.background='#cccccc';
}
</script>
Your click event should also be onclick:
<a onclick="Clicker(1)" href="#">clic</a>
source
share