//直接在js中写 <script language="javascript"> function EnterTextBox() { if(event.keyCode == 13 && document.all["TextBox1"].value != "") { event.keyCode = 9; event.returnValue = false; document.all["TextBox1"].click(); } } </script> <body onkeypress="return EnterTextBox()"> //此处TextBox1为页面上TextBox的ID <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')");
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛