by ag3nt42 » Wed Oct 07, 2009 10:20 pm
Below is a function written in javascript code that creates multi color letters.
- Code: Select all
<html>
<script>
function MyColorFunction()
{
var LetterArray = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
var FontCArray = ["red", "blue", "green", "purple", "orange", "red", "blue", "green", "purple", "orange", "red", "blue", "green", "purple", "orange", "red", "blue", "green", "purple", "orange", "red", "blue", "green", "purple", "orange", "yellow"];
for (var x=0; x<=25; x++)
{
//This code writes the string to the display.
//Notice how we plug in our variables.
//The [] section represents an index..
//That allows us to target each string in the arrays seperately.
document.writeln("<font color=" + FontCArray[x] + ">" + LetterArray[x]+ "</font>");
}
}
document.onload=MyColorFunction();
</script>
</html>
Administrator/Owner
Langauges I know
Web : XHTML, CSS, JavaScript, XML, PHP, ASP, SQL, ActionScript 3.0
Programming :Python, C#, VB, C, always learning more 8)