实用技巧:随机显示不同页面背景
下面是代码:
<script>
s=new Array(3)
s[0]=Math.floor(Math.random()*256)+""
s[1]=Math.floor(Math.random()*256)+""
s[2]=Math.floor(Math.random()*256)+""
a=s[0]+s[1]+s[2]
document.write("<body bgcolor="+a+">")
document.write("</body>")
</script>
<script>
s="icon/icon"+Math.floor(Math.random()*18)+".gif"
document.write("<body background="+s+">")
document.write("</body>")
</script>红绿蓝三种颜色:
<script>
s=new Array(3)
s[0]="ff0000"
s[1]="00ff00"
s[2]="0000ff"
i=Math.floor(Math.random()*3)
document.write("<body bgcolor="+s[i]+">")
document.write("</body>")
</script>按钮上:
<script>
s=new Array(3)
s[0]="ff0000"
s[1]="00ff00"
s[2]="0000ff"
i=Math.floor(Math.random()*3)
document.write("<input type='button' value='按钮' style=background-color:"+s[i]+">")
</script>随机显示图片:
将以下代码加在<head>与</head>之间。
<script LANGUAGE="JavaScript">
bg = new Array(3); //设定图片数量2
bg[1] = 'icon/1.gif'//显示的图片路径
bg[2] = 'icon/2.gif'
bg[3] = 'icon/3.gif'
index = Math.floor(Math.random()*bg.length);
document.write("<BODY BACKGROUND="+bg[index]+">");
</script>一、推荐使用迅雷或快车等多线程下载软件下载本站资源。
二、未登录会员无法下载,登录后可获得更多便利功能,若未注册,请先注册。
三、如果服务器暂不能下载请稍后重试!总是不能下载,请点我报错 ,谢谢合作!
四、本站大部分资源是网上搜集或私下交流学习之用,任何涉及商业盈利目的均不得使用,否则产生的一切后果将由您自己承担!本站将不对任何资源负法律责任.如果您发现本站有部分资源侵害了您的权益,请速与我们联系,我们将尽快处理.
五、如有其他问题,请加网站设计交流群(点击这里查看交流群 )进行交流。
六、如需转载本站资源,请注明转载来自并附带链接
七、本站部分资源为加密压缩文件,统一解压密码为:www.aizhanzhe.com
大家评论
站长推荐
