<script language="javascript">
function EnterTextBox(button)
{
if(event.keyCode == 13 && document.all["TextBox1"].value != "")
{
event.keyCode = 9;
event.returnValue = false;
document.all[button].click();
}
}
</script>
在PageLoad事件里
TextBox1.Attribute.add("onkeypress","EnterTextBox('Button1')");
<form runat="server" defaultbutton="linLogin">