Created
July 20, 2011 02:03
-
-
Save imaz/1094181 to your computer and use it in GitHub Desktop.
js fade in/out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>js study fade</title> | |
<script language="JavaScript"> | |
<!-- | |
itv = 50; | |
cnt = 0; | |
function strFade(str){ | |
c = str.charAt(cnt++); | |
document.getElementById("ID").style.color="#"+c+c+c+c+c+c; | |
if(cnt < str.length) setTimeout("strFade('"+str+"')",itv); | |
if(cnt str.length) cnt=0; | |
} | |
--> | |
</script> | |
</head> | |
<body> | |
<span id="ID">(´▽`)</span> | |
<br><br> | |
<input type="button" value="fade in" onClick="strFade('fedcba9876543210')"> | |
<input type="button" value="fade out" onClick="strFade('0123456789abcdef')"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment