javascript背景颜色按时变换
摘要:背景色测试functionsetcolor(){varcolorString;do{colorString="#"+Math.floor(M...
<head>
</head>
<bodyonload="setcolor()">
<divid=mydivstyle="font:12pxsans-serif;width:300px;height:200px;">背景色测试</div>
<script>
functionsetcolor()
{
varcolorString;
do{
colorString="#"+Math.floor(Math.random()*Math.pow(2,24)).toString(16);
}
while(colorString.length<7);
document.getElementById("mydiv").style.backgroundColor=colorString;
setTimeout(setcolor,100);
}
</script>
</body>
背景色测试
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
【javascript背景颜色按时变换】相关文章:
★ javascript实现table选中的行以指定颜色高亮显示
★ javascript消除window.close()的提示窗口