Background Fader


/ Published in: HTML
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script language="JavaScript">
  2. var Color= new Array(9);
  3. Color[1] = "ff";
  4. Color[2] = "ee";
  5. Color[3] = "dd";
  6. Color[4] = "cc";
  7. Color[5] = "bb";
  8. Color[6] = "aa";
  9. Color[7] = "99";
  10. Color[8] = "88";
  11. Color[9] = "77";
  12. Color[10] = "66";
  13. Color[11] = "55";
  14. Color[12] = "44";
  15. Color[13] = "33";
  16. Color[14] = "22";
  17. Color[15] = "11";
  18. Color[16] = "00";
  19. function fadeIn(where)
  20. {
  21. if (where >= 1)
  22. {
  23. document.bgColor="#" + Color[where] +"0000";
  24. where -= 1;
  25. setTimeout("fadeIn("+where+")", 15);
  26. }
  27. else
  28. {
  29. setTimeout('fadeOut(1)', 15);
  30. }
  31. }
  32. function fadeOut(where)
  33. {
  34. if (where <=16)
  35. {
  36. document.bgColor="#" + Color[where] +"0000";
  37. where += 1;
  38. setTimeout("fadeOut("+where+")", 15)
  39. }
  40. else
  41. {
  42. setTimeout("fadeIn(16)", 15);
  43. }
  44. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.