『转』js捕捉回车事件


转自:http://www.zhuoda.org/lunzi/104118.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=
"http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=
"Content-Type" content="text/html; charset=gb2312" />
<title>js捕捉回车事件</title>

<script>
function test(){
if (event.keyCode == 13)    {
         alert(
"捕捉住回车提交事件!");
     }
}
</script>


</head>

<body>

<form method=
"post">
标题:<input type=
"text" name="t" onkeydown="test();"/>
</form>

</body>
</html>
原文地址:https://www.cnblogs.com/abinxm/p/1707654.html