对于Asp.Net.在TextBox1中输入内容后,按下enter键后,执行Button1的click方法,在page_load事件增加如下代码即可实现:
TextBox1.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"+Button1.UniqueID+"').click();return false;}} else {return true}; ");