网页数字雨的代码

html-css020

网页数字雨的代码,第1张

<html>

<head>

<title>数字下掉黑客帝国效果</title>

</head><BODY BGCOLOR=#000000>

<script language="JavaScript">

<!--

if (document.all){

Cols=26//列数

Cl=28

Cs=40//间距

Ts=10

Tc='#008800'

Tc1='#00ff00'

MnS=20

MxS=30

I=Cs

Sp=new Array()S=new Array()Y=new Array()

C=new Array()M=new Array()B=new Array()

RC=new Array()E=new Array()Tcc=new Array(0,1)//数字显示组

document.write("<div id='Container' style='position:absolutetop:0left:-"+Cs+"'>")

document.write("<div style='position:relative'>")

for(i=0i <Colsi++){

S[i]=I+=Cs

document.write("<div id='A' style='position:absolutetop:0font-family:Arialfont-size:"

+Ts+"pxleft:"+S[i]+"width:"+Ts+"pxheight:0pxcolor:"+Tc+"visibility:hidden'></div>")

}

document.write("</div></div>")

for(j=0j <Colsj++){

RC[j]=1+Math.round(Math.random()*Cl)

Y[j]=0

Sp[j]=Math.round(MnS+Math.random()*MxS)

for(i=0i <RC[j]i++){

B[i]=''

C[i]=Math.round(Math.random()*1)+' '

M[j]=B[0]+=C[i]

}

}

function Cycle(){

Container.style.top=window.document.body.scrollTop

for (i=0i <Colsi++){

var r = Math.floor(Math.random()*Tcc.length)

E[i] = '<font color='+Tc1+'>'+Tcc[r]+'</font>'

Y[i]+=Sp[i]

if (Y[i] >window.document.body.clientHeight){

for(i2=0i2 <Colsi2++){

RC[i2]=1+Math.round(Math.random()*Cl)

for(i3=0i3 <RC[i2]i3++){

B[i3]=''

C[i3]=Math.round(Math.random()*1)+' '

C[Math.floor(Math.random()*i2)]=' '+' '

M[i]=B[0]+=C[i3]

Y[i]=-Ts*M[i].length/1.5

A[i].style.visibility='visible'

}

Sp[i]=Math.round(MnS+Math.random()*MxS)

}

}

A[i].style.top=Y[i]

A[i].innerHTML=M[i]+' '+E[i]+' '

}

setTimeout('Cycle()',20)

}

Cycle()

}

// -->

</script>

</body>

</html>

17个简洁风格flash时钟地址

咖啡色背景 http://www1.flashline.cn/flash.swf?id2=clock2/1

白色背景 http://www1.flashline.cn/flash.swf?id2=clock2/17

白色背景 http://www1.flashline.cn/flash.swf?id2=clock2/16

白色背景 http://www1.flashline.cn/flash.swf?id2=clock2/3

白色背景 http://www1.flashline.cn/flash.swf?id2=clock2/2

黑色背景 http://www1.flashline.cn/flash.swf?id2=clock2/4

黑色背景 http://www1.flashline.cn/flash.swf?id2=clock2/5

黑色背景 http://www1.flashline.cn/flash.swf?id2=clock2/6

黑色背景 http://www1.flashline.cn/flash.swf?id2=clock2/8

黑色背景 http://www1.flashline.cn/flash.swf?id2=clock2/9

黑色背景 http://www1.flashline.cn/flash.swf?id2=clock2/11

黑色背景 http://www1.flashline.cn/flash.swf?id2=clock2/12

绿色背景 http://www1.flashline.cn/flash.swf?id2=clock2/7

灰色背景 http://www1.flashline.cn/flash.swf?id2=clock2/13

灰色背景 http://www1.flashline.cn/flash.swf?id2=clock2/14

灰色背景 http://www1.flashline.cn/flash.swf?id2=clock2/15

红色背景 http://www1.flashline.cn/flash.swf?id2=clock2/10

效果:创建一个255个元素的数组,并初始化值为“1”,及255个元素都是字符串1

原理:

Array(256)有256个元素的空数组,join(1)将数据每个元素用1连接起来成一个字符串(256个数组需要用255个1连接),所以就是255个1组成的字符串,split('')将255个1分割成长度为255的数组