Cancel form submit when showing alerts
<p>I've come up against a weird problem when trying to cancel a form submit when the enter key is pressed in a text box.</p>

<p>Using the code below the form always submits when enter is pressed after I close the alert.  If I comment out the alert the form no longer submits on enter, the desired result. </p>

<pre><code>&lt;input id="myTextBox" type="text" onkeydown="return myFunction(event);"&gt;

function SearchOnEnter(event) {
    var key = event.charCode || event.keyCode || e.which || 0;

    if (key == 13) {
        alert('Test text.');

        return false;
    }
    else
        return true;
}
</code></pre>

<p>Is there a way to get the form not to submit after showing the alert?  Also any idea why the alert box is causing this problem?</p>

<p>Thanks</p>

<p>UPDATE, this doesn't seem to be an issue on IE, affects Firefox and chrome.</p>
