直接存为*.php文件运行即可。
1<html>
2<head>
3<title>The Matrix</title>
4<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
5<script language="javascript">
6// *****************************************************************
7// Written By Caocao
8// [email protected]
9// http://caocao.oso.com.cn
10// *****************************************************************
11number_h=<? echo $number_h;?>;
12number_w=<? echo $number_w;?>;
13step=5;
14text=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");
15grad=new Array("#000000","#004000","#008000","#00C000","#00FF00");
16
17function line()
18{
19this.start=100;
20this.end=60;
21this.restart=0;
22}
23
24function randchar()
25{
26return (text[Math.round(Math.random()*25)]);
27}
28
29function initial()
30{
31matrix=new Array();
32light=new Array();
33for (i=0;i<number_h;i++)
34{
35for (j=0;j<number_w;j++)
36{
37matrix[i*number_h+j]="<? echo $color_back;?>";
38}
39}
40for (j=0;j<number_w;j++)
41{
42light[j]=new line();
43}
44}
45
46function new_light()
47{
48for (j=0;j<number_w;j++)
49{
50if (light[j].restart==0)
51{
52light[j].start=0;
53light[j].end=-10-Math.round(Math.random()*20);
54light[j].restart=light[j].end-Math.round(Math.random()*20);
55}
56else
57{
58light[j].start++;
59light[j].end++;
60light[j].restart++;
61}
62}
63}
64
65function new_color(i,j)
66{
67if ((light[j].start-i)<5&&(light[j].start-i)>0)
68{
69return (light[j].start-i);
70}
71if ((i-light[j].end)<5&&(i-light[j].end)>0)
72{
73return (i-light[j].end);
74}
75if ((i-light[j].end)>4&&(light[j].start-i)>4)
76{
77return (4);
78}
79return (0);
80}
81
82function display()
83{
84for (i=0;i<number_h;i++)
85{
86for (j=0;j<number_w;j++)
87{
88eval("w"+i+"h"+j).innerHTML="<font color="+grad[new_color(i,j)]+">"+randchar()+"</font>";
89}
90}
91}
92
93function show()
94{
95new_light();
96display();
97setTimeout("show()",<? echo $speed;?>);
98}
99</script>
100<style type="text/css">
101<!--
102<?
103echo ".size,tr,td { font-size: ".$font_size."pt; line-height: ".$font_size."pt ;color:#00FF00}n";
104?>
105\-->
106</style>
107</head>
108<?
109echo "<body bgcolor=".$color_back.">";
110
111echo "<table border="0" cellpadding="0" cellspacing=".$space." width=".($number_w*$font_size).">";
112for ($i=0;$i<$number_h;$i++)
113{
114echo "<tr>";
115for ($j=0;$j<$number_w;$j++)
116{
117echo "<td id='w".$i."h".$j."'>M</td>";
118}
119echo "</tr>";
120}
121echo "</table>";
122?>
123
124<script language="javascript">
125initial();
126show();
127</script>
128
129</html>