fontcolor()

The fontcolor method is used to set the color of the outputted string text. The value of this method may be a Hexadecimal color value, (without the pound (#) sign, as is required in HTML), or one of the many standard named colors such as "red", blue", or "green". A full list of standard named colors may be found in the Articles and Tables section of the Walk The Geek Main Page. A string may be passed as the color, if the string text is one of the named colors within the Named Colors list.

syntax:

stringName.fontcolor(number)

stringName.fontcolor(namedColorString)

EXAMPLE

bigString = new String("This is the string text, colored Fuschia.");

document.write(bigString.fontcolor('FF00FF') )

The example first creates a new text string called bigString. A document.write statement is then used to write the contents of bigString to the window, invoking the fontcolor() method, which has been set to size "FF00FF, whic is also the Named Color, Fuschie. The output should be the string "This is the string text, colored Fuschia.", which will be displayed in the color "Fuschia" within your browser.