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

自己写的javascript五子棋

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>five-in-a-raw</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <style>
 <!--
  table{text-align: center;font-size: 20px;cursor: hand;empty-cells: show;table-layout: fixed;}
 -->
 </style>
  </head>
  <script type="text/javascript">
 <!--
 function FiveRawGame(){
  this.redChess="<font color=\"red\">X</font>";
  this.blackChess="<font color='black'>O</font>";
  //初始化棋盘和数据
  this.init=function(){
   var str="<table  width=\"600\" height=\"600;\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\"  >";
   for(var i=0;i<25;i++){
    str+="<tr height='7'>";
    for(var j=0;j<25;j++){
     str+="<td id='r"+i+"c"+j+"' onclick=\"FiveRawGame.chess("+i+","+j+")\" onmouseover=\"FiveRawGame.showMsg("+i+","+j+")\">&nbsp;</td>";
    }
    str+="</tr>";
   }
   str+="</table>";
   document.getElementById("main").innerHTML=str;
   this.allGrids=new Array();
   for(var a=0;a<25;a++){
    this.allGrids[a]=new Array();
   }
   for(var i=0;i<25;i++){
    for(var j=0;j<25;j++){
     this.allGrids[i][j]=new grid(i,j,"O");
    }
   }
   this.isChess=true;
   this.redArr=new Array();
   this.blackArr=new Array();
   this.allArr=new Array();


相关文档:

javascript入门基础知识

javascript入门基础知识
文章源于博客:http://www.cnblogs.com/seesky/articles/1433526.html
在网站制作的过程中经常需要用到JavaScript语句,掌握一些相关的JavaScript结构对网站制作有着重的重用!
1.document.write(""); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document->html->(head,body)
......

Javascript面向对象编程(二):继承


ZT:http://www.ruanyifeng.com/blog/2010/05/object-oriented_javascript_inheritance.html
上一次的文章,主要介绍了如何"封装"数据和方法,从原型对象生成实例。
今天要介绍的是,多个原型对象之间如何"继承"。
比如,现在有一个"动物"对象,
  function Animal(){
    this.species = "动物";
  }
还有 ......

Javascript 面向对象编程(一):封装


学习Javascript,最难的地方是什么?
我觉得,Object(对象)最难。因为Javascript的Object模型很独特,和其他语言都不一样,初学者不容易掌握。
下面就是我的学习笔记,希望对大家学习这个部分有所帮助。我主要参考了Object-Oriented JavaScript和Professional JavaScript for Web Developers (2nd Edition)这两本书。 ......

JavaScript的BASE64

**
* 我在网上看到过很多BASE64的JavaScript算法,都觉得不满意,于是自己写了一个,在这里分享一下。
* 我的代码在质量的效率都较高,没有一些冗余的操作。总体来讲我觉得非常不错。
* 如果大家有什么不懂的地方可以问我。
*/
var BASE64={
    /**
     * 此变量为编码的 ......

[翻译]High Performance JavaScript(006)

Identifier Resolution Performance  标识符识别性能
    Identifier resolution isn't free, as in fact no computer operation really is without some sort of performance overhead. The deeper into the execution context's scope chain an identifier exists, the slower it is to access for ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号