回车键搜索 - Enter搜索

  今天写了个 搜索  想来发表发表 

 

  

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="text" name="keyword" id="keyword" onkeydown="entersearch()"/>
<input type="button" value="搜索" onclick="search()"/>

<script src="jquery.js"></script>
<script>
function search(){
console.log('点击了 1111')
}
function entersearch(){
//alert(dd);
var event = window.event || arguments.callee.caller.arguments[0];
if (event.keyCode == 13)
{
search();
console.log('点击了 2222')
}
}
</script>
</body>
</html>

 

如有不足,还请大神指点一二

posted @ 2017-04-17 10:53  生活教会我长大  阅读(1576)  评论(0编辑  收藏  举报