<script type="text/javascript">
window.onload = function(){
document.getElementById("element").onchange = function(){
document.getElementById("div").style.background = this.checked ? 'red' : 'black';
};
};
</script>
<input type="checkbox" id="element" value="#" />
<div id="div" style="width: 100px; height: 20px; background: black"></div>