按钮与回车键关联的js代码
发布时间:2016-12-27 来源:查字典编辑
摘要:functiononEnterDown(){if(window.event.keyCode==13){onButOk();}}functio...
<html>
<head>
<script language='javascript'>
function onEnterDown(){
if(window.event.keyCode == 13){
onButOk();
}
}
function onButOk(){
--按钮的事件;
}
</script>
</head>
<body onkeydown='onEnterDown();'>
<input id="ButOk" type="button" accesskey="" value="登录" />
</body>
</html>