Monday, 2024-04-29, 2:20 AM
Welcome Guest | RSS
Farhan Khalid
Main | RAINBOW TEXT EFFECT - Forum | Registration | Login
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » Education Club » Javascript » RAINBOW TEXT EFFECT (<font color="red">RAINBOW TEXT EFFECT</font>)
RAINBOW TEXT EFFECT
Mind_blocker
Group: Removed
Rank:





Date:
Friday,
2009-03-27,
3:47 PM

Message # 1
STEP 1: Copy and paste the code below so that it sits between the <head> and </head> tags at the top of your web-page:

Quote

<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"); // change the colours if you want to
var alink="http://www.mf2fm.com/rv"; // page to link text to (set to ="" for no link)

/****************************
* Rainbow Text Effect *
*© 2003-6 mf2fm web-design*
* http://www.mf2fm.com/rv *
* DON'T EDIT BELOW THIS BOX *
****************************/
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>

STEP 2: Place a <span> element with 'id="rainbow"' on your web-page containing the text you wish to be turned into a rainbow. For example:

Quote

<span id="rainbow">RAINBOW TEXT</span>



This user has not applied a signature yet.
HTML code to this post
BB-code to this post
Direct link to this post

Message edited by manHunt - Friday, 2009-03-27, 3:48 PM
farhan411
Messages: 288
Group: Administrators
Title: Admin
Reputation: 0
Status: Offline

Awards: 1Loading awards ...
Date:
Saturday,
2009-03-28,
10:55 PM

Message # 2
nice dear....dear i know where you put this script nice work..........

keep it up..... cool


This user has not applied a signature yet.
HTML code to this post
BB-code to this post
Direct link to this post
Forum » Education Club » Javascript » RAINBOW TEXT EFFECT (<font color="red">RAINBOW TEXT EFFECT</font>)
  • Page 1 of 1
  • 1
Search:

Copyright MyCorp © 2024

Hosted by uCoz