本文介绍了如何使标签闪烁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在使用微软Visual Studio 2005 当我按下按钮时,如何让标签闪烁3次? i有此代码: 私有 Sub Button1_Click( ByVal sender As System。对象, ByVal e 作为 System.EventArgs)句柄 Button1.Click LBL1.Visible = True 如果 LBL1.Visible = True 然后 LBL1.Visible = 错误 结束 如果 结束 Sub 但它不起作用:/ 我该怎么做? 非常感谢!解决方案 查看我为您制作的示例程序: 在Windows窗体中 放置一个按钮和Lable: 按钮名称为:Button1 Lable名称为:LBL1 定时器conral as Timer1 声明一个公共整数变量为ival ' ---- public variable Dim ival As 整数 = 0 ' ----按钮单击启动计时器 私有 Sub Button1_Click(发件人 A s 系统。对象,e As System.EventArgs)句柄 Button1.Click LBL1.Visible = True Timer1.Interval = 200 Timer1.Enabled = True ival = 0 Timer1.Start() LBL1.Visible = True 结束 Sub ' ----计时器勾选事件使您的标签闪烁 私有 Sub Timer1_Tick(发件人 As System。 Object ,e As System.EventArgs) 句柄 Timer1.Tick 如果 LBL1.Visible = True 然后 LBL1.Visible = False Else LBL1.Visible = True 结束 如果 ival = ival + 1 如果 ival = 7 然后 如果 LBL1.Visible = False 然后 LBL1.Visible = True 结束 如果 Timer1 。停止() 结束 如果 结束 Sub 使用以下链接 http://stackoverflow.com/questions/3404228/how-to-blink-a-label-in-asp-net [ ^ ] http://www.dotnetspider.com/forum/126647-blinking-text-ASP.aspx [ ^ ] 或 尝试这个 < 正文 onload = changeColour('flashtext'); > < script type = text / javascript > 函数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 > 此文字将闪烁!!! < ; / p > < / body > I am using microsoft Visual Studio 2005How do I make a label blink 3 times when i push a button?i have this code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click LBL1.Visible = True If LBL1.Visible = True Then LBL1.Visible = False End IfEnd Subbut it doesnt work :/how do i do it?super thanks! 解决方案 Check this sample program i made for you :In windows formplace one Button and Lable:Button Name as :Button1Lable Name as :LBL1Timer conral as Timer1Declare one public integer variable as ival' ---- public variable Dim ival As Integer = 0' ---- Button Click Start the Timer Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click LBL1.Visible = True Timer1.Interval = 200 Timer1.Enabled = True ival = 0 Timer1.Start() LBL1.Visible = True End Sub' ---- Timer Tick Event blink your label Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick If LBL1.Visible = True Then LBL1.Visible = False Else LBL1.Visible = True End If ival = ival + 1 If ival = 7 Then If LBL1.Visible = False Then LBL1.Visible = True End If Timer1.Stop() End If End SubHi,Use below linkshttp://stackoverflow.com/questions/3404228/how-to-blink-a-label-in-asp-net[^]http://www.dotnetspider.com/forum/126647-blinking-text-ASP.aspx[^]ortry 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></body> 这篇关于如何使标签闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-22 21:31