Change body bg when hovering a div

http://stackoverflow.com/questions/11596626/how-can-i-change-a-divs-background-by-hovering-over-another-div/11596648#11596648

by thebabydino

HTML

<div class='change-bg'>Hover here</div>

CSS

body {
    background: #000;
}
.change-bg {
    width: 200px;
    height: 50px;
    background: #fff;
}

JavaScript

var el = document.querySelector('.change-bg');
el.addEventListener('mouseover', function(){
    document.body.style.backgroundColor = 'red';
}, true);
el.addEventListener('mouseout', function(){
    document.body.style.backgroundColor = 'black';
}, true);