Text Cross-Fader Script

Use this script to easily create crossfade color effects. Just put any text you want in "SPAN", "DIV", or "P" HTML tags, add a snippet of code, and the script does the rest. This effect only works in newer "standards" browsers such as IE5.5+, Netscape6+, and Mozilla. It will NOT work in IE4 or Netscape 4.x, but will not generate errors. Those older browsers will simply display the text normally.




Over 2000+ free Javascript
at JavaScriptBank.com Website

Sampled by JavaScriptBank.com View this page, please


Unfortunately, you can only use "pure" text (no HTML code). Here's what the script does to create this effect:
  1. The script actually "pulls" all the text out of the element whose ID you specified.
  2. Next, it separates each character from each other.
  3. Then it wraps each of those characters in its own <SPAN> tag.
  4. It then calculates what each character's color will be based on the starting and ending colors you specified and applies the color to the appropriate character.
  5. Finally, it "puts" all those separate <SPAN> tags back into the orginal element. Voila!
Therefore, if you try to apply the effect to the following code: <span id="img1" style="font-weight:bold"><img src="button.gif"> Example Button</span>
You would get this: Example Button
When you really probably wanted this: Example Button

For those of you who want to know why it does this: When the script separates all the characters, it splits up the parts of the HTML tags that would normally be rendered. Since the HTML tag is split up, the browser renders each character as if it were by itself, which they really are since each is separartely wrapped in its own SPAN tag.




Installation: