html:
<input type=”text” name=”keyword” id=”keyword” onkeydown=”entersearch()”/>
<input type=”button” onclick=”search()”/>
注意:不要用form
js:
function search(){
$keyword = $(“#keyword”).val();
window.location.href = “/list-0-0-0-0-“+$keyword+”-0-0-1.html”;
}
function entersearch(){
//alert(dd);
var event = window.event || arguments.callee.caller.arguments[0];
if (event.keyCode == 13)
{
search();
}
}
js实现搜索框响应回车键
发表于
发表回复