function pad(n){
return n.length<2?'0'+n:n;
}
function rndHex(){
var base = 16,
resultNum = Math.floor(Math.random()*base*base).toString(base);
return pad(resultNum);
}
function rndHexColor(){
return'#'+rndHex()+rndHex()+rndHex();
}
function changeColor(){
this .style.backgroundColor=rndHexColor();
}
document.getElementById('ID_of_element').addEventListener('mouseenter', changeColor);