js控制网页随机变色 - Www.aseoe.Com
<script type="text/javascript">
onload = function () {
var oBody = document.body;
setInterval(function () {
// [0, 256)即0-255的颜色值,然后通过rgb标准来设置background-color。
//数值越小 背景色变化波动越小
r = Math.floor(Math.random()*20);
g = Math.floor(Math.random()*20);
b = Math.floor(Math.random()*20);
oBody.style.backgroundColor = "rgb(" + r + ", " + g + ", " + b + ")";
}, 5000);
}
</script>
<script type="text/javascript" language="javascript">
//
</script>
<script type="text/javascript" language="javascript" src="http://sudu.cn/js/get_ad.js?width=248&height=248" id="bigwww_script13"></script>