<p>I have a form with a textbox and a button. IE is the only browser that will not submit the form when Enter is pressed (works in FF, Opera, Safari, Chrome, etc.).  I found this javascript function to try to coax IE into behaving; but no avail:</p>

<pre><code>function checkEnter(e){
    var characterCode
    if (e &amp;&amp; e.which) {
        e = e
        characterCode = e.which
    } else {
        e = event
        characterCode = e.keyCode
    }
    if (characterCode == 13) {
        document.forms[0].submit()
        return false
    } else {
        return true
    }
}
</code></pre>

<p>Implementation:  </p>

<pre><code>searchbox.Attributes("OnKeyUp") = "checkEnter(event)"
</code></pre>

<p>Any advice?</p>

<p><strong>EDIT:</strong> <a href="http://www.codeproject.com/KB/aspnet/EnterKeyToButtonClick.aspx" rel="noreferrer">This page</a> on <a href="http://www.codeproject.com/" rel="noreferrer">CodeProject</a> outlines what Dillie was saying, and it works perfectly.</p>

```
```
// Use the following Javascript in your HTML view
// put it somewhere between <head> and </head>

    <script language="JavaScript" type="text/javascript"><!--
    function KeyDownHandler(btn)
    {
      if (event.keyCode == 13)
      {
        event.returnValue=false;
        event.cancel = true;
        btn.click();
      }
    }
    // -->
    </script>

    // Put this in your TextBox(es) aka inside <asp:textbox ... >
    onkeydown="KeyDownHandler(ButtonID)"
```
```