如何在asp.net中闪烁标签

时间:2010-08-04 09:31:40

标签: c# asp.net

我想在asp.net页面中闪烁一个标签,但是当我把它眨眼整个页面时,不是那个标签。

4 个答案:

答案 0 :(得分:2)

使用Java脚本中的随机颜色闪烁文本

在脚本标记

<script language="javascript" type="text/javascript">
        var hexvalues
= Array( "A", "B", "C", "D", "E", "F", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" );

        function flashtext() {

           var colour = '#';
           for( var counter = 1; counter <= 6; counter ++ ) {
            var hexvalue = hexvalues[ Math.floor( hexvalues.length * Math.random() ) ];

                colour = colour + hexvalue;

            }
           document.getElementById( "flashingtext" ).style.color = colour;
             } 

       setInterval("flashtext()", 500 );



</script>

并将其写入正文部分

<div id="flashingtext" style="font-size:25px;">    
    JavaScript Flashing Text
</div>

答案 1 :(得分:1)

使用Jquery blink插件..

Jquery Blink

$('.blink').blink(); // default is 500ms blink interval.
//$('.blink').blink(100); // causes a 100ms blink interval

答案 2 :(得分:1)

<script type="text/javascript">
function Startblink()
{
    var lbl = document.getElementById('Label1');
    lbl.style.textDecoration = 'blink';
}
</script>

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

<input id="btn" type="button" value="Blink" onclick="Startblink();" />

点击按钮

Label1.Attributes.Add("style", "text-decoration:blink");

答案 3 :(得分:0)

我试过这个

 <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Add blinking effect to text in jQuery</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
blinkeffect('#txtblnk');
})
function blinkeffect(selector) {
$(selector).fadeOut('slow', function() {
$(this).fadeIn('slow', function() {
blinkeffect(this);
});
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="txtblnk"> <p><strong><font color="red">Blinking Effect Using Jquery</font></strong></p> </div>
</form>
</body>
</html>

这是100%正常工作。参考here