基本上我想要做的就是讓文本閃爍不同的顏色。等文本閃爍藍色,然後紅色,然後粉紅色,然後紫色等。預先感謝Javascript - Solid Text Text Flash
0
A
回答
1
您可以使用CSS3而不是Javascript。下面的示例從紅色閃爍到黃色,綠色,藍色並返回紅色。記得添加特定於供應商的前綴爲Mozilla,webkit的等(例如-moz動畫和-moz關鍵幀)
的index.html
<!doctype html>
<html>
<head>
<title>Blinking Text</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="test">Text</div>
</body>
</html>
的style.css
.test
{
font-size: 48pt;
animation: 2s blink steps(1) infinite;
}
@keyframes blink
{
0% { color: red; }
25% { color: yellow; }
50% { color: green; }
75% { color: blue; }
100% {color: red; }
}
0
看看這個jsfiddle。我已經評論了JS的每個部分的教學目的:http://jsfiddle.net/VXRpz/
0
function flashtext(ele,col) {
var tmpColCheck = document.getElementById(ele).style.color;
if (tmpColCheck === 'silver') {
document.getElementById(ele).style.color = col;
} else {
document.getElementById(ele).style.color = 'silver';
}
}
setInterval(function() {
flashtext('flashingtext','red');
flashtext('flashingtext2','blue');
flashtext('flashingtext3','green');
}, 500); //set an interval timer up to repeat the function
相關問題
- 1. text/plain vs text/javascript
- 2. HTML flash like text replication
- 3. Eclipse Android Text Text Text = String text
- 4. flash html text選項卡
- 5. xml data to dynamic text AS3 flash
- 6. javascript clickable text
- 7. Javascript Createable Text
- 8. Javascript Text Expander
- 9. JavaScript text Resize
- 10. Text Shuffle JQuery/Javascript
- 11. text/javascript vs application/javascript
- 12. libmagic。 text/plain代替文本/ javascript text/css
- 13. I18N/Angular JS/Javascript Text
- 14. Javascript,Text Annotations and Ideas
- 15. javascript alert message russian text
- 16. tableview text over previous text
- 17. JQuery $(this).find(「#id」)。text(「text」)not change text
- 18. 使用正則表達式將(,,, text ,, 4,text,3 ,,)轉換爲(text,4,text,3)
- 19. Sublime Text 2 Licensing - Sublime Text 2
- 20. Ruby on Rails之間:text text:?
- 21. preg_match「Text」「Mabye text」「Eight Numbers」
- 22. Jquery $(:text)and $(input [type =「text」])
- 23. Text and Forumla In Shape Text
- 24. 對JavaScript使用type =「text/plain」?
- 25. Javascript Input Text Masking without Plugin
- 26. Javascript onmouseover trying to add「to text
- 27. javascript changing .text字體顏色
- 28. 的JavaScript/<text area >
- 29. javascript wrap with text標籤
- 30. text to csv search function javascript
那麼......你究竟遇到了什麼問題?你有什麼嘗試? – 2012-02-16 06:56:50