简单问题!!! 把ttt.js贴出来看看吧,不然诊断不了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的ttt.js 有问题<body onload="playermoves();">这样也行! ttt.js如下:function isblank(n){ if(owns("player",n)||owns("computer",n) { return false; } return true;}function owns(who,i){ var fr=parent.parent.frames[1]; var doc=fr.document; var field=doc.forms[0].element[i]; if(field==null||field.value=who) { return true; } Else { return false; }}function setowner(who,n){ var fr=parent.parent.frames[1]; var doc=fr.document; var field=doc.forms[0].element[n]; field.value=who;}function tictactoe(who,n1,n2,n3){ if(owns(who,n1)&&owns(who,n2)&&owns(who,n3)) { var color=parent.frames[0].document.bgcolor; for(var i=0;i<9;i++) { parent.frames[i].document.bgcolor="black"; parent.frames[n1].document.bgcolor=color; parent.frames[n2].document.bgcolor=color; parent.frames[n3].document.bgcolor=color; return ture; } } return false; }function istictactoe(who){ if(tictactoe(who,0,1,2)) return true; if(tictactoe(who,3,4,5)) return true; if(tictactoe(who,6,7,8)) return true; if(tictactoe(who,0,3,6)) return true; if(tictactoe(who,1,4,7)) return true; if(tictactoe(who,2,5,8)) return true; if(tictactoe(who,0,4,8)) return true; if(tictactoe(who,2,4,6)) return true; return false;}function computermoves(){ var moved=false; while(!moved) { var newmove=Math.round(9*Math.random()); if (isblank(newmove)) { setowner("computer",newmove); var fr=parent.frames[newmove]; fr.location.href="x.html"; moved=true; } } }function playermoves(){ if(isblank(cell)) { setowner("player",cell); location.href="o.html"; if(!istictactoe("player")) computermoves(); istictactoe("computer"); }} function isblank(n){ if(owns("player",n)||owns("computer",n)<-晕!很明显少个括号…… { return false; } return true;} 文本框内容改变,onchange事件没有触发【高分求救,万分感谢】 js购物车问题,请高手帮忙!不知道是什么问题?郁闷了几天 有要学习eralng的吗? 求一个页面效果 [DOM] nodeName = "#text",可是我要取它的节点名字 怎么办? 验证select表单的输入 DIV移动的问题 100分紧急求救! 怎样定义在页面内任何javascript代码段和javascript函数中都有效的全局变量?在JSP中用js变量保存了跳转菜单的URL,跳转菜单通过servlet完 求JS大神帮助 如何把F5给禁用 十万火急!!!请大哥、大姐帮忙(在线等待)
<body onload="playermoves();">这样也行!
function isblank(n)
{
if(owns("player",n)||owns("computer",n)
{
return false;
}
return true;
}function owns(who,i)
{
var fr=parent.parent.frames[1];
var doc=fr.document;
var field=doc.forms[0].element[i];
if(field==null||field.value=who)
{
return true;
}
Else
{
return false;
}
}function setowner(who,n)
{
var fr=parent.parent.frames[1];
var doc=fr.document;
var field=doc.forms[0].element[n];
field.value=who;
}function tictactoe(who,n1,n2,n3)
{
if(owns(who,n1)&&owns(who,n2)&&owns(who,n3))
{
var color=parent.frames[0].document.bgcolor;
for(var i=0;i<9;i++)
{
parent.frames[i].document.bgcolor="black";
parent.frames[n1].document.bgcolor=color;
parent.frames[n2].document.bgcolor=color;
parent.frames[n3].document.bgcolor=color;
return ture;
}
}
return false;
}function istictactoe(who)
{
if(tictactoe(who,0,1,2))
return true;
if(tictactoe(who,3,4,5))
return true;
if(tictactoe(who,6,7,8))
return true;
if(tictactoe(who,0,3,6))
return true;
if(tictactoe(who,1,4,7))
return true;
if(tictactoe(who,2,5,8))
return true;
if(tictactoe(who,0,4,8))
return true;
if(tictactoe(who,2,4,6))
return true;
return false;
}function computermoves()
{
var moved=false;
while(!moved)
{
var newmove=Math.round(9*Math.random());
if (isblank(newmove))
{
setowner("computer",newmove);
var fr=parent.frames[newmove];
fr.location.href="x.html";
moved=true;
}
}
}function playermoves()
{
if(isblank(cell))
{
setowner("player",cell);
location.href="o.html";
if(!istictactoe("player"))
computermoves();
istictactoe("computer");
}
}
{
if(owns("player",n)||owns("computer",n)<-晕!很明显少个括号……
{
return false;
}
return true;
}