当前位置:首页 > 网页特效 > 颜色背景 >

为Body添加代码让网页背景不停变化

时间:2013-05-30 22:11 来源:互联网 作者:源码搜藏 收藏 推荐

运行代码 保存代码 复制代码 提示:您可以先修改部分代码再运行,保存代码功能在Firefox下无效。
  • 让网页背景不停变化,在鼠标移动到网页上的时候,改Math.random后面的数字可改变颜色值,鼠标移开后就不再变化了,只需一句话就可实现背景变换效果,平时用的不多,不过在编写网页游戏的时候,使用广泛。
  • <html>
    <head>
    <title>背景颜色不停变化</title>
    </head>
    <body style="margin:0px;" onmousemove='this.style.backgroundColor="#" + Math.floor(Math.random()*16581375).toString(16)' >
    </body>
    </html>

由源码搜藏网整理,转载请注明出处https://www.codesocang.com/tx-yanse/4917.html

颜色背景下载排行

最新文章