I am trying to implement a search functionality that is capturing the enter key and redirecting to a different page in an ASP.NET 3.5 application. Unfortunately it does not work in Firefox (version 3.5) but in IE it is working perfectly. Please see the following code:
Script:
function searchKeyPress(e) {
if (window.event) { e = window.event; }
if (e.keyCode == 13) {
document.getElementById('btnSearch').click();
}
}
function redirect() {
document.location = "http://localhost:5555/search.aspx?q=keyword";
}
Markup:
<form name="form1" method="post" runat="server" id="form1"/>
<input type="text" id="txtSearch" onkeypress="searchKeyPress(event);"/>
<input type="button" id="btnSearch" Value="Search" onclick="redirect();"/>
</form/>
Has anyone else experienced this issue?
Any help would be appreciated!