随机的变换背景颜色
<script language="javascript">
function a(){
var bg=new Array()
bg[0]={bgColor:'blue',bgImg:'1.gif'}
bg[1]={bgColor:'red',bgImg:'2.gif'}
bg[2]={bgColor:'green',bgImg:'3.gif'}
index=Math.floor(Math.random()*bg.length);
document.write(bg[index].bgColor+" "+bg[index].bgImg);
document.body.bgColor=bg[index].bgColor;
document.body.background="icon/icon"+bg[index].bgImg
setTimeout("a()",1000)}
</script>
想要的效果是随机变换背景颜色!