html 文字閃爍功能的 js 程式碼
阿新 • • 發佈:2019-01-27
<span id="blink"><b>文字閃爍</b></span>
<script type = "text/javascript" >
function blinklink() {
if (!document.getElementById('blink').style.color) {
document.getElementById('blink').style.color = "red";
}
if (document.getElementById('blink').style.color == "red") {
document.getElementById('blink').style.color = "#FFFFFF";
} else {
document.getElementById('blink').style.color = "red";
}
timer = setTimeout("blinklink()", 500);
}
function stoptimer() {
clearTimeout(timer);
}
blinklink()
</script>
<script type = "text/javascript" >
function blinklink() {
if (!document.getElementById('blink').style.color) {
document.getElementById('blink').style.color = "red";
}
if (document.getElementById('blink').style.color == "red") {
document.getElementById('blink').style.color = "#FFFFFF";
} else {
document.getElementById('blink').style.color = "red";
}
timer = setTimeout("blinklink()", 500);
}
function stoptimer() {
clearTimeout(timer);
}
blinklink()
</script>