高分求解 当前页面上那个控件获得了焦点 假设1个aspx页面上有2个TextBox 2个DropDownList 我想知道这4个控件中 那个控件获得了焦点.请问这个问题如何解决?谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <script language="javascript"> function focuswhat(obj) { //debugger; document.getElementById("Label1").innerText=obj.id; } </script></head><body scroll=yes> <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem Value=1>1</asp:ListItem> </asp:DropDownList> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:DropDownList ID="DropDownList2" runat="server"> <asp:ListItem Value=2>2</asp:ListItem> </asp:DropDownList> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <asp:Label ID="Label1" runat="server" Text="Label" Width="78px"></asp:Label></div> </form></body></html>protected void Page_Load(object sender, EventArgs e){ this.TextBox1.Attributes.Add("onfocus", "focuswhat(this);"); this.TextBox2.Attributes.Add("onfocus", "focuswhat(this);"); this.DropDownList1.Attributes.Add("onfocus", "focuswhat(this);"); this.DropDownList2.Attributes.Add("onfocus", "focuswhat(this);");} 关于伪静态原理的疑问 wap问题? 如何自学好C和C# 然后学精ASP.NET 如何ItemDataBound中获取自定义控件 关于datagrid的问题 请教时间的显示问题 datagird傳遞的id為什麼是亂碼? Worksheet.SaveAs 能不能把指定的一个sheet保存成html? 如何设置鼠标的样式 EasyUi datagrid 数据加载(很奇葩!希望大神可以解答一下!) WEB程序做多好,發現很少會用到什麽反射,委託,線程,序列化什麽的。。。 求求好心人帮小弟一个挺简单的问题?
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
function focuswhat(obj)
{
//debugger;
document.getElementById("Label1").innerText=obj.id;
}
</script>
</head>
<body scroll=yes>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value=1>1</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem Value=2>2</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label" Width="78px"></asp:Label></div>
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
this.TextBox1.Attributes.Add("onfocus", "focuswhat(this);");
this.TextBox2.Attributes.Add("onfocus", "focuswhat(this);");
this.DropDownList1.Attributes.Add("onfocus", "focuswhat(this);");
this.DropDownList2.Attributes.Add("onfocus", "focuswhat(this);");
}