如何每5分钟闪烁一次Asp.net中的标签. [英] How to Blink a LABEL in Asp.net for every 5 minutes.
问题描述
如何每5分钟闪烁一次Asp.net中的标签.
================================================== =====
尊敬的朋友,
我有一个标签...此标签在我的网络表单上设置为日期".
它必须每5分钟闪烁一次.....它应仅闪烁10秒钟然后消失.
请您告诉我如何操作.
在此先感谢.
How to Blink a LABEL in Asp.net for every 5 minutes.
=======================================================
Dear Friends,
I have a Label...This label is set as Date on my webform.
It must BLINK for every 5 minutes.....it should blink for just 10 seconds and go.
Please can u show me, how to do this.
Thanks in Advance.
推荐答案
嗨
试试这个
Hi
try this
<body onload="changeColour('flashtext');">
<script type="text/javascript">
function changeColour(elementId) {
var interval = 1000;
var colour1 = "#ff0000"
var colour2 = "#000000";
if (document.getElementById) {
var element = document.getElementById(elementId);
element.style.color = (element.style.color == colour1) ? colour2 : colour1;
setTimeout("changeColour('" + elementId + "')", interval);
}
}
</script>
<p id="flashtext">This text will flash!!!</p>
希望对您有帮助
祝好运
Hope this will Help u
Best Luck
您好,Ubaid,
参考System.Threading,将AJAX计时器控件和ScriptManager添加到aspx页面.
Hi Ubaid,
Reference System.Threading, add an AJAX timer control and a ScriptManager to your aspx page.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:timer runat="server" ID="tmr1" Interval="300000" ontick="tmr1_Tick"></asp:timer>
<h1><asp:Label Text="" ID="lblTestTimer" runat="server"></asp:Label></h1>
在timer_tick事件中,输入以下代码:
in timer_tick event put the following codes:
protected void tmr1_Tick(object sender, EventArgs e)
{
lblTestTimer.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt");
lblTestTimer.Visible = true;
Thread.Sleep(10000);
lblTestTimer.Visible = false;
}
这将达到您想要的效果...干杯!!
快乐编码:)
Sunny_K
This will do the trick what you want...Cheers !!
Happy Coding :)
Sunny_K
您好,
尝试在ASP.Net中使用替代控制.以下文章可能会帮助您入门:
http://msdn.microsoft.com/en-us/library/ms228212.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/ms228212.aspx [ ^ ]
http://asp-net-example.blogspot.in/2008/11/aspnet-substitution-control-example-how.html [如何使用替换
Hello,
Try using Substitution Control in ASP.Net. Below articles may help you to get going:
http://msdn.microsoft.com/en-us/library/ms228212.aspx[^]
http://msdn.microsoft.com/en-us/library/ms228212.aspx[^]
http://asp-net-example.blogspot.in/2008/11/aspnet-substitution-control-example-how.html[^]
How to Use Substitution
这篇关于如何每5分钟闪烁一次Asp.net中的标签.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!