trouble catching enter keystroke in javascript
<p>this seems simple, but i can't make it work.</p>

<p>i'm trying to catch an enter keystroke, and run some code, but when i hit enter, the page refreshes and nothing happens.</p>

<p>here's my script</p>

<pre><code>function GetChar(event) {
    var keyCode = ('which' in event) ? event.which : event.keyCode;
    if (keyCode == '13') {
        var cQuery = document.getElementById('searchfield').value;
        var cURL = 'ProductGrid.aspx?Query=' + escape(cQuery);
        document.location = cURL;
    };
</code></pre>

<p>wheni hit enter the page is refreshed, and the search field is cleared, but it doesn't run any of the code in the if block</p>
