随机变换背景图象

<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、Ubuntu+Apache+PHP+MySQL+Memcached
https://www.onexin.net/ubuntuapachephpmysqlmemcached/

2、PHP trait 实现一种代码复用的方法
https://www.onexin.net/php-trait/

3、UCH群组内话题移动方法新鲜出炉
https://www.onexin.net/uch-group-method-within-the-topic-of-mobile-freshly/

4、JS实现的滑动展开与折叠效果
https://www.onexin.net/js-to-achieve-the-sliding-expand-and-collapse-results/

5、C#中MessageBox用法大全
https://www.onexin.net/c-messagebox-usage-daquan/

Leave a Reply