tic tac toe with javascript
<p>I am writing a tic tac toe game using html, css, and JavaScript.I have created buttons to get input from <code>markbox(cell)</code> function and deres function called winning_condition  which cheks the conditions to win the game.</p>

<p>In my code it's not checking <code>winning_condition</code> properly wats it encountering problem??</p>

<p>Here's my code </p>

<hr>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;TIC TAC TOE&lt;/title&gt;
    &lt;script type="text/javascript"&gt;
    var cell;
    var symbol = "X";
    function markbox(cell)
    {
        if (cell.value == "     ")
        {
        cell.value = symbol;
        if (symbol == "X")
        symbol = "O";
        else
        symbol = "X";
        }
        //else 
        //{
        //alert("This square is occupied");
        //}
        if (winning_condition())
        {
        alert ("You win!");
        return;
        }
        else  if(!winning_condition())
        {
        alert("You loose!");
        }
        else 
        {
        alert("Draw!")
        }
    }
    function winning_condition()
        {
        if(document.f1.b00.value==symbol &amp;&amp; document.f1.b01.value==symbol &amp;&amp; document.f1.b02.value==symbol)
        return true;
        else if(document.f1.b10.value==symbol &amp;&amp; document.f1.b11.value==symbol &amp;&amp; document.f1.b12.value==symbol)
        return true;
        else if(document.f1.b20.value==symbol &amp;&amp; document.f1.b21.value==symbol &amp;&amp; document.f1.b22.value==symbol)
        return true;
        else if(document.f1.b00.value==symbol &amp;&amp; document.f1.b10.value==symbol &amp;&amp; document.f1.b20.value==symbol)
        return true;
        else if(document.f1.b01.value==symbol &amp;&amp; document.f1.b11.value==symbol &amp;&amp; document.f1.b21.value==symbol)
        return true;
        else if(document.f1.b02.value==symbol &amp;&amp; document.f1.b12.value==symbol &amp;&amp; document.f1.b22.value==symbol)
        return true;
        else if(document.f1.b00.value==symbol &amp;&amp; document.f1.b11.value==symbol &amp;&amp; document.f1.b22.value==symbol)
        return true;
        else if(document.f1.b02.value==symbol &amp;&amp; document.f1.b11.value==symbol &amp;&amp; document.f1.b20.value==symbol)
        return true;
        }
    function clearBtn()
    {
        status = "X"
        document.f1.b00.value="   ";
        document.f1.b01.value="   ";
        document.f1.b02.value="   ";
        document.f1.b10.value="   ";
        document.f1.b11.value="   ";
        document.f1.b12.value="   ";
        document.f1.b20.value="   ";
        document.f1.b21.value="   ";
        document.f1.b22.value="   ";
    }
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div align="center"&gt;
    &lt;h1&gt;Tic Tac Toe&lt;/h1&gt;
    &lt;form name="f1"&gt;
        &lt;input type="button" name="b00" value="     " onclick="markbox(this)"/&gt;
        &lt;input type="button" name="b01" value="     " onclick="markbox(this)"/&gt;
        &lt;input type="button" name="b02" value="     " onclick="markbox(this)/&gt;&lt;/br&gt;
        &lt;input type="button" name="b10" value="     " onclick="markbox(this)"/&gt;
        &lt;input type="button" name="b11" value="     " onclick="markbox(this)"/&gt;
        &lt;input type="button" name="b12" value="     " onclick="markbox(this)"/&gt;&lt;/br&gt;
        &lt;input type="button" name="b20" value="     " onclick="markbox(this)"/&gt;
        &lt;input type="button" name="b21" value="     " onclick="markbox(this)"/&gt;
        &lt;input type="button" name="b22" value="     " onclick="markbox(this)"/&gt;
        &lt;/br&gt;&lt;/br&gt;&lt;/br&gt;
        &lt;input type="reset" value="RESET GAME" onclick="clearBtn()"&gt;
    &lt;/form&gt;     
    &lt;/div&gt;
&lt;/body&gt;
</code></pre>

<p></p>
