c#响应Enter键事件
windows窗体
this.cancelButton = this.button1;//设置Esc键
this.AcceptButton = this.button2;//设置Enter键
web页面
<script type="text/javascript" language="javascript">
function document.onkeydown()//响应Enter事件
{
if(event.keyCode == 13)
document.all("Button1").click();//设置要响应的的button
}
</script>
<body onkeydown="if(event.keyCode==13) return false;"> 相信自己
this.cancelButton = this.button1;//设置Esc键
this.AcceptButton = this.button2;//设置Enter键
web页面
<script type="text/javascript" language="javascript">
function document.onkeydown()//响应Enter事件
{
if(event.keyCode == 13)
document.all("Button1").click();//设置要响应的的button
}
</script>
<body onkeydown="if(event.keyCode==13) return false;"> 相信自己