直接存为*.php文件运行即可。 $color_back="#000000"; $number_w=8; $number_h=6; $space=1; $f $speed=0; ?> The Matrix <br>// ***************************************************************** <br>// Written By Caocao <br>// caocao@eastday.com <br>// http://caocao.oso.com.cn <br>// ***************************************************************** <br>number_h=<? echo $number_h;?>; <br>number_w=<? echo $number_w;?>; <br>step=5; <br>text=new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"); <br>grad=new Array("#000000","#004000","#008000","#00C000","#00FF00"); <br>function line() <br>{ <br> this.start=100; <br> this.end=60; <br> this.restart=0; <br>} <br>function randchar() <br>{ <br> return (text[Math.round(Math.random()*25)]); <br>} <br>function initial() <br>{ <br> matrix=new Array(); <br> light=new Array(); <br> for (i=0;i<number_h;i++) <br> { <br> for (j=0;j<number_w;j++) <br> { <br> matrix[i*number_h+j]="<? echo $color_back;?>"; <br> } <br> } <br> for (j=0;j<number_w;j++) <br> { <br> light[j]=new line(); <br> } <br>} <br>function new_light() <br>{ <br> for (j=0;j<number_w;j++) <br> { <br> if (light[j].restart==0) <br> { <br> light[j].start=0; <br> light[j].end=-10-Math.round(Math.random()*20); <br> light[j].restart=light[j].end-Math.round(Math.random()*20); <br> } <br> else <br> { <br> light[j].start++; <br> light[j].end++; <br> light[j].restart++; <br> } <br> } <br>} <br>function new_color(i,j) <br>{ <br> if ((light[j].start-i)<5&&(light[j].start-i)>0) <br> { <br> return (light[j].start-i); <br> } <br> if ((i-light[j].end)<5&&(i-light[j].end)>0) <br> { <br> return (i-light[j].end); <br> } <br> if ((i-light[j].end)>4&&(light[j].start-i)>4) <br> { <br> return (4); <br> } <br> return (0); <br>} <br>function display() <br>{ <br> for (i=0;i<number_h;i++) <br> { <br> for (j=0;j<number_w;j++) <br> { <br> eval("w"+i+"h"+j).innerHTML="<font color="+grad[new_color(i,j)]+">"+randchar()+""; <br> } <br> } <br>} <br>function show() <br>{ <br> new_light(); <br> display(); <br> setTimeout("show()",<? echo $speed;?>); <br>} <br> <br><!-- <br><? <br> echo ".size,tr,td { font-size: ".$font_size."pt; line-height: ".$font_size."pt ;color:#00FF00}n"; <br>?> <br>--> <br> echo ""; echo ""; for ($i=0;$i { echo ""; for ($j=0;$j { echo "M"; } echo ""; } echo ""; ?> <br> initial(); <br> show(); <br> 浠ヤ