<style type="text/css">
#div1, #div2 {
border: 1px solid #DDDDDD;
margin: 50px auto;
}
#div1 {
width: 200px;
height: 100px;
}
#div2 {
background: #FFFFFF;
width: 100px;
height: 50px;
}
</style>
<script type="text/javascript">
window.onload = function(){
var div1 = document.getElementById("div1");
var div2 = document.getElementById("div2");
div2.onclick = function(){
div1.style.background = (div1.style.background == '#000000') ? '' : '#000000';
};
};
</script>
<div id="div1">
<div id="div2"></div>
</div>