Posted By

KardiWeb on 01/11/11


Tagged

text Neon


Versions (?)

Neon text


 / Published in: JavaScript
 

Neon Text your website!

  1. <script language="JavaScript1.2">
  2.  
  3. var message="Welcome to SNIPPLR!"
  4. var neonbasecolor="gray"
  5. var neontextcolor="yellow"
  6. var flashspeed=100 //in milliseconds
  7.  
  8. ///No need to edit below this line/////
  9.  
  10. var n=0
  11. if (document.all||document.getElementById){
  12. document.write('<font color="'+neonbasecolor+'">')
  13. for (m=0;m<message.length;m++)
  14. document.write('<span id="neonlight'+m+'">'+message.charAt(m)+'</span>')
  15. document.write('</font>')
  16. }
  17. else
  18. document.write(message)
  19.  
  20. function crossref(number){
  21. var crossobj=document.all? eval("document.all.neonlight"+number) : document.getElementById("neonlight"+number)
  22. return crossobj
  23. }
  24.  
  25. function neon(){
  26.  
  27. //Change all letters to base color
  28. if (n==0){
  29. for (m=0;m<message.length;m++)
  30. //eval("document.all.neonlight"+m).style.color=neonbasecolor
  31. crossref(m).style.color=neonbasecolor
  32. }
  33.  
  34. //cycle through and change individual letters to neon color
  35. crossref(n).style.color=neontextcolor
  36.  
  37. if (n<message.length-1)
  38. n++
  39. else{
  40. n=0
  41. clearInterval(flashing)
  42. setTimeout("beginneon()",1500)
  43. return
  44. }
  45. }
  46.  
  47. function beginneon(){
  48. if (document.all||document.getElementById)
  49. flashing=setInterval("neon()",flashspeed)
  50. }
  51. beginneon()
  52.  
  53.  
  54. </script>

Report this snippet  

You need to login to post a comment.