自己写的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+")\"> </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();
相关文档:
在Web开发中,会遇到从一页(父页)导向另一页(子页),并且要求“返回”父页的情况,在这里如果用ASP.NET提供的 Response.Redirect()方法,往往不会达到理想的效果,例如:返回后,重新加载了页面,无法保存导向子页前的状态,等等,在这里我就介绍 一下如何使用JavaScript中history.go()函数来实现返回 ......
<script>setTimeout("redirect('<?=$url_forward?>');", <?=$ms?>);</script>
设置分页:$page $pagesize $offset = ($page-1)*$pagesize;
$limit = "limit $offset,$pagesize" ......
功能:
重新加载文档。
语法:
location.reload(force)
参数:
force:可选参数,是一个布尔值。
如果省略参数,或者参数是false,它就会用HTTP头If-Modified-Since来检测服务器上的文档是否已改变。如果文档已改
变,reload()会再次下载该文档。如果文档未改变,则该方法将从缓存中 ......
第三章 DOM Scripting DOM编程
DOM scripting is expensive, and it's a common performance bottleneck in rich web applications. This chapter discusses the areas of DOM scripting that can have a negative effect on an application's responsiveness and gives recommendations o ......
Cloning Nodes 节点克隆
Another way of updating page contents using DOM methods is to clone existing DOM elements instead of creating new ones—in other words, using element.cloneNode() (where element is an existing node) instead of document.createElement().
&nbs ......