我想在asp.net页面中闪烁一个标签,但是当我把它眨眼整个页面时,不是那个标签。
答案 0 :(得分:2)
<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插件..
$('.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