方法1:用JS实现
function getKey(event)
{
if(event.keyCode==13)
{
go();
}
function go()
{
var dd=document.getElementById("words").value;
top.location.href=" arch.aspx?wd="+dd;
}
==================================================================
方法2:回车触发指定按钮的事件:
function SubmitKeyClick(button)
{
if (event.keyCode == 13)
{
event.keyCode=9;
event.returnValue = false;
document.all[button].click();
}
}
// -->
在Page_Load事件中添加:
word.Attributes.Add("onkeydown","SubmitKeyClick('ser');");
方法三:也就是最简单的方法(defaultbutton)
现在又有个问题如何获取用户控件上的Button的ID,一个同事介绍的好方法,直接浏览页面,右键源代码找到ID为left_login1$Button1。
最后我在后台这样使用




