<div><p></p></div><h4>鼠标移动随机变色</h4><script>var oDiv = document.querySelector('div');
oDiv.onmousemove=function(){this.style.background =randColor()}functionrandColor(){var r =parseInt(Math.random()*256);var g =parseInt(Math.random()*256);var b =parseInt(Math.random()*256);return'rgb('+ r +','+ g +','+ b +')'}</script>