2008年1月9日星期三

javascript 文字闪烁

<html>
<head>

<script type="text/javascript">
function blinklink()
{
if (!document.getElementById('message').style.color)
{
document.getElementById('message').style.color="red"
}
if (document.getElementById('message').style.color=="red")
{
document.getElementById('message').style.color="black"
}
else
{
document.getElementById('message').style.color="red"
}
timer=setTimeout("blinklink()",100)
}

function stoptimer()
{
clearTimeout(timer)
}
</script>
</head>

<body onload="blinklink()" onunload="stoptimer()">
<div id="message" >Message</div>

<div id="new_task">Message</a>

<script language="JavaScript">
<!-- Begin
function initArray() {
for (var i = 0; i < initArray.arguments.length; i++) {
this[i] = initArray.arguments[i];
}
this.length = initArray.arguments.length;
}
var colors = new initArray(
"red",
"blue",
"green",
"purple",
"black",
"tan",
"red");
delay = .5; // seconds
link = 0;
vlink = 0;
function linkDance() {
link = (link+1)%colors.length;
vlink = (vlink+1)%colors.length;
new_task.style.color = colors[link];
setTimeout("linkDance()",delay*1000);
}
function linkDance1() {
link = (link+1)%colors.length;
vlink = (vlink+1)%colors.length;
new_task1.style.color = colors[link];
setTimeout("linkDance1()",delay*1000);
}

linkDance();

// End -->
</script>
</body>

</html>

没有评论:

发表评论