Hide an ASP.NET Label control after a few seconds


I needed a way to hide an ASP.NET Label control after a few seconds.

here is the code to do that :

<form id=”form1″ runat=”server”>
<div>
<asp:Label runat=”server” ID=”label1″ Text=”First”></asp:Label>
</div>
</form>

<script type=”text/javascript”>
self.setInterval(“changeValue()”,4000);

function changeValue()
{
document.getElementById(“label1”).innerText = “”;

}
</script>

Advertisements

2 thoughts on “Hide an ASP.NET Label control after a few seconds

  1. hi Thyagaraju,

    you can attach your code between script tags as i have already given the exmple in my posts ,
    now after every 4 seconds changeValue javascript code will get executed without any event call on page..
    so u need not to write any event for label..it will be automatically get executed..

    self.setInterval(”changeValue()”,4000);

    function changeValue()
    {
    document.getElementById(”label1″).innerText = “”;

    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s