把ttt.js贴出来看看吧,不然诊断不了

解决方案 »

  1.   

    你的ttt.js 有问题
    <body onload="playermoves();">这样也行!
      

  2.   

    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");

    }
    }
      

  3.   

    function isblank(n)
    {
    if(owns("player",n)||owns("computer",n)<-晕!很明显少个括号……
    {
    return false;
    }
    return true;
    }