In my HTML page, I had a textbox for user to input keyword for searching. When they click the search button, the JavaScript function will generate a URL and run in new window.
The JavaScript function work properly when the user clicks the search button by mouse, but there is no response when the user presses the ENTER key.
function searching(){
var keywordsStr = document.getElementById('keywords').value;
var cmd ="http://XXX/advancedsearch_result.asp?language=ENG&+"+ encodeURI(keywordsStr) + "&x=11&y=4";
window.location = cmd;
}
<form name="form1" method="get">
<input name="keywords" type="text" id="keywords" size="50" >
<input type="submit" name="btn_search" id="btn_search" value="Search"
onClick="javascript:searching(); return false;" onKeyPress="javascript:searching(); return false;">
<input type="reset" name="btn_reset" id="btn_reset" value="Reset">
</form>