why wont the function get called ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 1051109210
    New Member
    • Mar 2007
    • 29

    why wont the function get called ?

    Hi! why doesnt my computermove() get called second time round? Note: computermove() is done to this it out first...
    Code:
    function onclick(square) {
    
     var value = square.value;
     if(value != 'X' && value != 'O')
     {
    
    
    square.value = 'X';
    numMoves++;
    computermove();
    numMoves++;
     
    }
    }//function onclick
    
    
    
    
    function computermove(){
    
    if(b1_1.value=" ")
    {b1_1.value="O";}
    else if(b0_0.value=" ")
    {b0_0.value="O";}
    
    }
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    can you post a link, so I can have a look at it (don't like to make up the HTML myself)?

    Comment

    • 1051109210
      New Member
      • Mar 2007
      • 29

      #3
      oh um its in my google gadget .... but by just readin through the code it seems right, right?

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        more or less. but there are some points to check:
        is every variable set right?
        is there any polymorphism making trouble? (it's good practice to not use variable/function names that JS already uses somewhere, e.g. onclick)
        what does Error Console/FireBug say?
        are the Events properly registered?

        Comment

        Working...