Rainbow text

Hoxxy

New Member
Copy and paste the code below to you "headinclude" template:

HTML:
<script type="text/javascript">
// <![CDATA[
var speed=100; // speed colours change, 1 second = 1000
var raincol=new Array("#ff0000", "#ff9900", "#ffff00", "#99ff00", "#00ff00", "#00ff99", "#00ffff", "#0099ff", "#0000ff", "#9900ff", "#ff00ff", "#ff0099"); var alink="";
var rainbow, raintxt, raincnt=0;
window.onload=function() { if (document.getElementById) {
  var i, raini;
  rainbow=document.getElementById("rainbow");
  raintxt=rainbow.firstChild.nodeValue;
  while (rainbow.childNodes.length) rainbow.removeChild(rainbow.childNodes[0]);
  for (i=0; i<raintxt.length; i++) {
    raini=document.createElement("span");
    raini.setAttribute("id", "rain"+i);
    raini.appendChild(document.createTextNode(raintxt.charAt(i)));
    if (alink) {
      raini.style.cursor="pointer";
      raini.onclick=function() { top.location.href=alink; }
    }
    rainbow.appendChild(raini);
  }
  rainbow=setInterval ("raining()", speed);
}}
function raining() {
  for (var i=0; i<raintxt.length; i++) document.getElementById("rain"+i).style.color=raincol[(i+raincnt)%raincol.length];
  raincnt++;
}
// ]]>
</script>

Wrap the text you want to have rainbow effect like this:
HTML:
<span id="rainbow">RAINBOW TEXT</span>

The attachment is just a gif to show you basicly what this does. ;)

Ive tried and tested it for UserGroup html and sadly it dosen't work for this but is fine for wrapping text in templates.
 
Back
Top