62,075
社区成员
发帖
与我相关
我的任务
分享
function MyForm.onkeydown()
{
with(window.event)if(keyCode==13)keyCode=9
}
if (this.ActiveElementID1.ActiveClientID != string.Empty)
this.Page.SetFocus(this.ActiveElementID1.ActiveClientID); //加上这一句OK了
<%@ Page Language="C#" %>
<script runat="server">
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
this.TextBox4.Text = DateTime.Now.ToLongTimeString();
this.Page.SetFocus(this.ActiveElementID1.ActiveClientID); //加上这一句OK了
}
</script>
<%@ Register Src="ActiveElementID.ascx" TagName="ActiveElementID" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server" onkeydown="with(window.event)if(keyCode==13)keyCode=9">
<uc1:ActiveElementID ID="ActiveElementID1" runat="server" />
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" OnTextChanged="TextBox1_TextChanged"></asp:TextBox><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox><br />
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br />
</form>
</body>
</html>