.aspx

ASP.NET 判断TextBox获得焦点事件    <div>
ASP.NET 判断TextBox获得焦点事件        
<asp:TextBox ID="txtUser" runat="server" Text="请输入用户名"></asp:TextBox>
ASP.NET 判断TextBox获得焦点事件        
<br />
ASP.NET 判断TextBox获得焦点事件        
<asp:TextBox ID="txtPwd" runat="server" TextMode="Password" ></asp:TextBox>  
ASP.NET 判断TextBox获得焦点事件    
</div>

.aspx.cs

ASP.NET 判断TextBox获得焦点事件    protected void Page_Load(object sender, EventArgs e)
    }
实现效果和HTML控件效果
ASP.NET 判断TextBox获得焦点事件<input type="text" value="请输入用户名" onfocus="if(value=='请输入用户名') {value=''}" onblur="if (value=='') 
{value='请输入用户名'}"
/>
ASP.NET 判断TextBox获得焦点事件
<br/>
ASP.NET 判断TextBox获得焦点事件
<input type="password" value="请输入密码" onfocus="if(value=='请输入密码') {value=''}"
ASP.NET 判断TextBox获得焦点事件    onBlur
="if(value=='') {value='请输入密码'}"/>

相关文章: