以回车键为例:
<script language="javascript" event="onkeydown" for="document">
if(event.keyCode==13)
{
if (document.activeElement.id=='指定ID')
{
document.all('按钮ID').focus();
document.all('按钮ID').click();
}
}
</script>
c#
private void Page_PreRender(object sender, EventArgs e)
{
this.TextBox1.Attributes["onkeydown"] =
"if(event.keyCode==13)" + this.Page.ClientScript.GetPostBackEventReference(this.Button1, null);
}
Kyle