PHP+javascript模拟Matrix画面
2015-01-24信息快讯网
<?
$color_back="#000000";
$number_w=8;
$number_h=6;
$space=1;
$font_size=20;
$speed=0;
?>
<html>
<head>
<title>The Matrix</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
// *****************************************************************
// Written By Caocao
// [email protected]
// http://caocao.oso.com.cn
// *****************************************************************
number_h=<? echo $number_h;?>;
number_w=<? echo $number_w;?>;
step=5;
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");
grad=new Array("#000000","#004000","#008000","#00C000","#00FF00");
function line()
{
this.start=100;
this.end=60;
this.restart=0;
}
function randchar()
{
return (text[Math.round(Math.random()*25)]);
}
function initial()
{
matrix=new Array();
light=new Array();
for (i=0;i<number_h;i++)
{
for (j=0;j<number_w;j++)
{
matrix[i*number_h+j]="<? echo $color_back;?>";
}
}
for (j=0;j<number_w;j++)
{
light[j]=new line();
}
}
function new_light()
{
for (j=0;j<number_w;j++)
{
if (light[j].restart==0)
{
light[j].start=0;
light[j].end=-10-Math.round(Math.random()*20);
light[j].restart=light[j].end-Math.round(Math.random()*20);
}
else
{
light[j].start++;
light[j].end++;
light[j].restart++;
}
}
}
function new_color(i,j)
{
if ((light[j].start-i)<5&&(light[j].start-i)>0)
{
return (light[j].start-i);
}
if ((i-light[j].end)<5&&(i-light[j].end)>0)
{
return (i-light[j].end);
}
if ((i-light[j].end)>4&&(light[j].start-i)>4)
{
return (4);
}
return (0);
}
function display()
{
for (i=0;i<number_h;i++)
{
for (j=0;j<number_w;j++)
{
eval("w"+i+"h"+j).innerHTML="<font color="+grad[new_color(i,j)]+">"+randchar()+"</font>";
}
}
}
function show()
{
new_light();
display();
setTimeout("show()",<? echo $speed;?>);
}
</script>
<style type="text/css">
<!--
<?
echo ".size,tr,td { font-size: ".$font_size."pt; line-height: ".$font_size."pt ;color:#00FF00}n";
?>
-->
</style>
</head>
<?
echo "<body bgcolor=".$color_back.">";
echo "<table width=".($number_w*$font_size)." border=0 cellspacing=".$space." cellpadding=0>";
for ($i=0;$i<$number_h;$i++)
{
echo "<tr>";
for ($j=0;$j<$number_w;$j++)
{
echo "<td id=w".$i."h".$j.">M</td>";
}
echo "</tr>";
}
echo "</table>";
?>
<script language="javascript">
initial();
show();
</script>
</body>
</html>
php sprintf()函数让你的sql操作更安全
PHP写入WRITE编码为UTF8的文件的实现代码
用php+javascript实现二级级联菜单的制作
Gregarius中文日期格式问题解决办法
php出现Cannot modify header information问题的解决方法大全
WINDOWS下php5.2.4+mysql6.0+apache2.2.4+ZendOptimizer-3.3.0配置
php Undefined index和Undefined variable的解决方法
Linux下ZendOptimizer的安装与配置方法
isset和empty的区别
PHP+javascript液晶时钟
PHP与javascript的两种交互方式
用PHP和ACCESS写聊天室(六)
用PHP和ACCESS写聊天室(五)
对javascript和select部件的结合运用
Search Engine Friendly的URL设计
PHP与javascript对多项选择的处理
PHP也可以成Shell Script
使用Apache的rewrite技术
JavaScript中如何创建数组
JavaScript数组的遍历方法
no match title
no match title
no match title
no match title
no match title