按钮与回车键关系的js编码


拷贝编码
编码以下:

<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="登陆" onclick="onButOk()" />
</body>
</html>