求助:关于控件隐藏与显示
请问各位:能否实现当特定的textbox获得焦点时一个id=“Button1”的button显示,当textbox失去焦点时此button隐藏
以下是我写的代码:但运行不出以上所说的效果,请高手帮忙修改一下!谢谢
<%@ Page language="c#" Codebehind="shiyan.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.ZhuCe.shiyan" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>shiyan</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function show()
{
document.getElementById("Button1").style.display="";
}
function asd()
{
document.getElementById("Button1").style.display="none";
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" onFocus="show()" onBlur="asd()" style="Z-INDEX: 101; LEFT: 272px; POSITION: absolute; TOP: 120px"
runat="server"></asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 472px; POSITION: absolute; TOP: 120px" runat="server"
Text="Button" Visible="False"></asp:Button>
</form>
</body>
</HTML>