How to redirect current tab on submit using javascript?
<p>I does a small example to learn javascript and php.
I try window.open() and window.location() but it opens a new tab and the current tab still redirects to "login.php"</p>

<pre><code>&lt;html&gt;
    &lt;head&gt;

        &lt;script type = "text/javascript"&gt;
            function checksubmit(form){
                if ( form.id.value == ""  || form.password.value == "" ){
                    $check = confirm("Don't leave id or password blank !\nPress OK to continue ... ");
                    if ($check)
                        window.open("http://www.google.com/");
                    else 
                        window.location("http://www.yahoo.com");    

                }
            }
        &lt;/script&gt;
    &lt;/head&gt;
&lt;body&gt;
        &lt;form align = 'right' method = 'post' action = 'login.php'&gt;
            ID : &lt;input type = 'text' name = 'id' maxlength = 20 /&gt;&lt;/br&gt;
            Password : &lt;input type = 'password' name = 'pass'  /&gt;&lt;/br&gt;
            &lt;input type = 'submit' name = 'submit' value = 'Login' onclick = "checksubmit(this.form)"/&gt;
        &lt;/form&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I want my page not to redirect to "login.php" when press ok or cancel.</p>
