随机变换背景图象

<Script Language=”JavaScript”>
image = new Array(4); //定义image为图片数量的数组
image [0] = ‘tu0.gif’ //背景图象的路径
image [1] = ‘tu1.gif’
image [2] = ‘tu2.gif’
image [3] = ‘tu3.gif’
image [4] = ‘tu4.gif’
number = Math.floor(Math.random() * image.length);
document.write(“<BODY BACKGROUND=”+image[number]+”>”);
</Script>

转载请注明出处:https://www.onexin.net/randomly-change-background-image/

随机文章:

1、Discuz!X优化“Oops! System file lost”文件不存在的代码错误提示
https://www.onexin.net/discuzxoops-system-file-lost/

2、Memcache命令及参数用法
https://www.onexin.net/memcache-command-line-usage/

3、最优秀的css样式reset.css
https://www.onexin.net/the-best-css-style-reset/

4、PHP Iterator(迭代器)接口
https://www.onexin.net/php-iterator/

5、正则表达式+修正符(进阶篇)
https://www.onexin.net/regular-expression-modifier-advanced-chapter/

Leave a Reply