I've been working on implementing a search feature in an ASP.NET 3.5 application that captures the enter key and redirects to a different page. It's been working flawlessly in Internet Explorer, but unfortunately, I've run into an issue with Firefox (version 3.5). Below is the code I've been using:
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 come across this issue before?
Any assistance would be greatly appreciated!