在文本框焦点清空标签 [英] Empty a label on textbox focus

查看:68
本文介绍了在文本框焦点清空标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI All ,,



我使用标签在文本框的基础上显示一些消息,,,问题是我想要清空该标签当我再次开始在文本框中写字时......



任何人都可以给我提示这样做..因为我无法找到任何有用的事件这样做。





: - (

HI All,,

I am using a label to display some message on the basis of textboxes,,, Problem is that I want that label to be emptied again when I start to write in the textbox again....

Can anybody give me the hint to do that.. coz i m unable to find any useful event to do that.


:-(

推荐答案

1.添加 onFocus 事件到 TextBox

1. Add onFocus event to TextBox.
<asp:TextBox id="TextBox1" runat="server" onfocus="EmptyLabel()"></asp:TextBox>





2.写 javaScript 函数。



2. Write the javaScript function.

<script type="text/javascript">
    function EmptyLabel()
    {
        document.getElementById("lblId").value = "";
    }
</script>


清空 TextBox.GotFocus [ ^ ]事件处理程序。
Empty the label content in TextBox.GotFocus[^] event handler.


这篇关于在文本框焦点清空标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆