您的位置:首页 > Web前端 > JavaScript

诘屈聱牙之javascript中国象棋

2007-04-07 00:00 309 查看
IE6.0 Only
非XHTML标准,可能IE 7.0也看不了....哈哈
蓝方先走


* { font:24px arial, "宋体"; font-weight:bold; color:white; cursor:default; }
table { table-layout:fixed; border-collapse:collapse; position:absolute; left:50px; top:50px; }
td { width:80px; height:80px; border:1px solid silver; color:black; text-align:center; line-height:80px; }

img.i1 { width:78px; height:78px; }
img.i2 { width:49px; height:49px; }
img.i3 { width:25px; height:49px; }

.chessman_red { background:url(/attachments/2007/3/29/20070329_2187cc5e9def581951f2v22EfdUSXQ7J.jpg); width:50px; height:50px; line-height:50px; text-align:center; }
.chessman_blue { background:url(/attachments/2007/3/29/20070329_5caa80c54f776b93bd582BwraVRWXf43.jpg); width:50px; height:50px; line-height:50px; text-align:center; }


var tb;
var cch=new Array();
var his=new Array();
var players=["red","blue"];
var curPlayer=1;

window.onload=function(){

document.onselectstart=function(){ return(false); }

document.onclick=do_click;
document.oncontextmenu=do_context;

tb=document.createElement("table");
document.body.appendChild(tb);

for(var i=0;ithis.y?y:this.y;
for(var i=mi+1;ithis.x?this.x:x;
ma=x>this.x?x:this.x;
for(var i=mi+1;i4)return(false);
if(cch[(this.y+y)/2*9+(this.x+x)/2])return(false);
break;
case "象":
if(Math.abs(this.x-x)!=2||Math.abs(this.y-y)!=2||y4){
if(y-this.y!=-1)return(false);
}else{
if(!((y-this.y==-1&&x==this.x)||(y==this.y&&Math.abs(this.x-x)==1)))return(false);
}
break;
//}else{
if(ythis.y?this.y:y;
ma=y>this.y?y:this.y;
for(var i=mi+1;ithis.x?this.x:x;
ma=x>this.x?x:this.x;
for(var i=mi+1;ithis.y?this.y:y;
ma=y>this.y?y:this.y;
for(var i=mi+1;ithis.x?this.x:x;
ma=x>this.x?x:this.x;
for(var i=mi+1;i
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: