易截截图软件、单文件、免安装、纯绿色、仅160KB

JavaScript贪吃蛇

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>贪食蛇</title></head>
<body>
<mce:style type="text/css"><!--
.table_back{width:320px;height:320px;border-bottom:1px solid black;border-right:1px solid black;}
.floor{border-left:1px solid black;border-top:1px solid black;font-size:1px;}
--></mce:style><style type="text/css" mce_bogus="1">.table_back{width:320px;height:320px;border-bottom:1px solid black;border-right:1px solid black;}
.floor{border-left:1px solid black;border-top:1px solid black;font-size:1px;}</style>
<mce:script type="text/javascript"><!--
/*--
标题:简单的贪吃蛇
设计:王集鹄
博客:http://blog.csdn.net/zswang
日期:2010年1月22日
--*/
function Snake(options) {
var self = this;
options = options || {};
this.colCount = options.colCount || 20;
this.rowCount = options.rowCount || 20;
this.parent = options.parent || document.body; // 容器
this.speed = options.speed || 200; // 移动间隔时间
this.initLength = options.initLength || 3; // 初始长度

this.button_replay = document.createElement("input");
this.button_replay.type = "button";
this.button_replay.value = "replay";
this.button_replay.onclick = function() {
self.replay();
};
this.parent.appendChild(this.button_replay);
this.table_back = document.createElement("table");
this.table_back.className = "table_back";
this.table_back.cellPadding = "0px";
this.table_back.cellSpacing = "0px";
this.playing = false; // 是否在进行中
this.floors = {}; // 矩阵地板矩阵 [y,x]
for (var i = 0; i < this.rowCount; i++) {
var tr = this.table_back.insertRow(-1);
for (var j = 0; j < this.colCount; j++) {
var td = tr.insertCell(-1);
td.classNa


相关文档:

用Javascript判断图片是否在存在

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>php爱好者|phpfans.net|---判断远程图片是否存在,否则替换成默认图片</title>
</head>
<body>
<p>判断远程图片是否存在,不存在的话替换成默认的 ......

href=“#”与href=“javascript:void(0)”区别

使用过ajax的都常见这样的代码:
<a href="javascript:doTest2();void(0);" mce_href="javascript:doTest2();void(0);">here</a>
但这儿的void(0)究竟是何含义呢?
Javascript中void是一个操作符,该操作符指定要计算一个表达式但是不返回值。
void 操作符用法格式如下:
1. javascript:void (expres ......

JavaScript 调用后台事件和方法

1、后台方法:
protected string CsharpVoid(string strCC)
{
strCC = "http://" + strCC;
return strCC;
}
2、前台页面JavaScript方法:
<script language="javascript" type="text/javascript">
var v = "www.baidu.com";
var s = '<%=CsharpVoid("'+v+'")%>';
document.write(s);
< ......

javascript中的null和undefined

javascript中的null和undefined
本文装载网络,版权归原作者所有。
null :表示无值;
undefined : 表示一个未声明的变量,
                或已声明但没有赋值的变量,
          &nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号