JavaScript - return false from function is not working?
<p>I m calling a javascript function on asp.net button client click and want to prevent post back. function works but it do not stop to be posted back. My Javascript is:</p>

<pre><code>function User2Check()
    {
        var user2id=document .getElementById("txtP2UserName");
        var user2password=document .getElementById("txtP2Password");

        if(user2id.value=='' &amp; user2password.value!='')
        {
            alert("User name is required");
            user2id=document .getElementById("txtP2UserName").foucs();
            e.preventDefault();                
            return false;
        }
        if(user2id.value!='' &amp; user2password.value=='')
        {
            alert("Password is required");
            user2id=document .getElementById("txtP2UserPassword").foucs();
            e.preventDefault();                
            return false;

        }


    }
</code></pre>

<p>The I am calling this function is:</p>

<pre><code>&lt;asp:Button runat="server" ID="btnSubmit" OnClientClick="return User2Check();" TabIndex="12" Text="Submit" onclick="btnSubmit_Click" /&gt;
</code></pre>

<p>plz guide.</p>
